<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-typescript-compiler-api-gap-that-wasn-t-ast-specific-pca2qnbg3" -->

---
title: The TypeScript Compiler API Gap That Wasn’t AST-Specific
description: Discussion about "The TypeScript Compiler API Gap That Wasn’t AST-Specific" on daily.dev - join the developer community
canonical: https://daily.dev/posts/the-typescript-compiler-api-gap-that-wasn-t-ast-specific-pca2qnbg3
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The TypeScript Compiler API Gap That Wasn’t AST-Specific | daily.dev
og:description: Discussion about "The TypeScript Compiler API Gap That Wasn’t AST-Specific" on daily.dev - join the developer community
og:url: https://daily.dev/posts/the-typescript-compiler-api-gap-that-wasn-t-ast-specific-pca2qnbg3
og:image: https://api.daily.dev/og/posts/PcA2qNbG3.png
og:image:alt: The TypeScript Compiler API Gap That Wasn’t AST-Specific
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The TypeScript Compiler API Gap That Wasn’t AST-Specific

**[Open Source](https://daily.dev/sources/opensourcenew)** · [@nyaomaru](https://daily.dev/nyaomaru) · 0 upvotes · 0 comments

## Content

I thought I was investigating a TypeScript Compiler API gap.

Then I reproduced the same behavior with plain objects. 👀

That changed the conclusion: it isn’t really AST-specific.

It’s a generic property-refinement composition problem.

```
import { and, refineKey } from 'is-kit';

// The same behavior occurs with ordinary object types.
type Baz = { readonly type: 'baz'; readonly value: string };
type OtherChild = { readonly type: 'other' };
type Child = Baz | OtherChild;

type Foo = { readonly kind: 'foo'; readonly bar: Child };
type Other = { readonly kind: 'other' };
type Input = Foo | Other;

const isFoo = (value: Input): value is Foo => value.kind === 'foo';
const isBaz = (value: Child): value is Baz => value.type === 'baz';

export const nativeIsFooWithBaz = (value: Input) =>
  isFoo(value) && isBaz(value.bar);
// Inferred: (value: Input) => boolean

export const isFooWithBaz = and(isFoo, refineKey('bar', isBaz));
// Inferred without a manual parent intersection annotation:
// (value: Input) => value is Foo & { bar: Baz }
```

[is-kit](https://github.com/nyaomaru/is-kit) preserves the checked parent + child intersection when the predicate is extracted for reuse, without requiring a manual return-type annotation.

#TypeScript #JavaScript #OpenSource #WebDev

---

[View this post on daily.dev](https://daily.dev/posts/the-typescript-compiler-api-gap-that-wasn-t-ast-specific-pca2qnbg3)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/the-typescript-compiler-api-gap-that-wasn-t-ast-specific-pca2qnbg3","headline":"The TypeScript Compiler API Gap That Wasn’t AST-Specific","text":"Discussion about \"The TypeScript Compiler API Gap That Wasn’t AST-Specific\" on daily.dev - join the developer community","url":"https://daily.dev/posts/the-typescript-compiler-api-gap-that-wasn-t-ast-specific-pca2qnbg3","datePublished":"2026-09-07T15:13:20.312Z","dateModified":"2026-09-07T15:13:20.312Z","author":{"@type":"Person","name":"nyaomaru","url":"https://daily.dev/nyaomaru","image":"https://avatars.githubusercontent.com/u/90489696?v=4","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":430}},"image":"https://media.daily.dev/image/upload/s--Lecs04bB--/f_auto/v1788794001/posts/PcA2qNbG3?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/opensourcenew","name":"Open Source"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Open Source","item":"https://daily.dev/squads/opensourcenew"},{"@type":"ListItem","position":3,"name":"The TypeScript Compiler API Gap That Wasn’t AST-Specific"}]}
```

