<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ts7-ast-reusable-parent-child-guards-without-manual-intersections-j2mkgto9l" -->

---
title: TS7 AST: Reusable Parent-Child Guards Without Manual...
description: A small open-source library called is-kit addresses a gap in TypeScript 7's AST types, where broad Node/Expression types don't narrow as discriminated unions...
canonical: https://daily.dev/posts/ts7-ast-reusable-parent-child-guards-without-manual-intersections-j2mkgto9l
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: TS7 AST: Reusable Parent-Child Guards Without Manual Intersections | daily.dev
og:description: A small open-source library called is-kit addresses a gap in TypeScript 7's AST types, where broad Node/Expression types don't narrow as discriminated unions...
og:url: https://daily.dev/posts/ts7-ast-reusable-parent-child-guards-without-manual-intersections-j2mkgto9l
og:image: https://api.daily.dev/og/posts/j2mKGtO9L.png
og:image:alt: TS7 AST: Reusable Parent-Child Guards Without Manual Intersections
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.

# TS7 AST: Reusable Parent-Child Guards Without Manual Intersections

**[nyaomaru](https://daily.dev/sources/graxwfjk0eop4zs3tdzdr)** · [@nyaomaru](https://daily.dev/nyaomaru) · 1 min read · 0 upvotes · 0 comments

## Summary

A small open-source library called is-kit addresses a gap in TypeScript 7's AST types, where broad Node/Expression types don't narrow as discriminated unions through direct kind checks, and reusable predicates combining parent+child conditions previously inferred only boolean. Using composable helpers like and() and refineKey(), a reusable type guard can retain full type refinement (e.g. narrowing to CallExpression with a refined expression: Identifier) without manually writing intersection type annotations. Tested against TypeScript 7.0.2 and a pinned 7.1 nightly build.

## Content

Tested on TS 7.0.2 + a pinned 7.1 nightly.

The shipped broad `Node` / `Expression` types still don’t narrow as discriminated unions through direct `kind` checks.

And when you extract a parent + child condition into a reusable native predicate, it can infer only `boolean`.

With [is-kit](https://github.com/nyaomaru/is-kit):

```
const isIdCall = and(
  ast.isCallExpression,
  refineKey('expression', ast.isIdentifier)
);
```

the reusable guard keeps the full refinement:

```
ast.CallExpression & {
  expression: ast.Identifier;
}
```

No manual parent intersection annotation needed.

#TypeScript #OpenSource #TypeSafety

---

Tags: [#open-source](https://daily.dev/tags/open-source), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/ts7-ast-reusable-parent-child-guards-without-manual-intersections-j2mkgto9l)

```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/ts7-ast-reusable-parent-child-guards-without-manual-intersections-j2mkgto9l","headline":"TS7 AST: Reusable Parent-Child Guards Without Manual Intersections","text":"A small open-source library called is-kit addresses a gap in TypeScript 7's AST types, where broad Node/Expression types don't narrow as discriminated unions through direct kind checks, and reusable predicates combining parent+child conditions previously inferred only boolean. Using composable helpers like and() and refineKey(), a reusable type guard can retain full type refinement (e.g. narrowing to CallExpression with a refined expression: Identifier) without manually writing intersection type annotations. Tested against TypeScript 7.0.2 and a pinned 7.1 nightly build.","url":"https://daily.dev/posts/ts7-ast-reusable-parent-child-guards-without-manual-intersections-j2mkgto9l","datePublished":"2026-09-05T15:18:53.615Z","dateModified":"2026-09-05T15:19:14.197Z","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--jL2FX1Rv--/f_auto/v1788621534/posts/j2mKGtO9L?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/graxwfjk0eop4zs3tdzdr","name":"nyaomaru"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"nyaomaru","item":"https://daily.dev/sources/graxwfjk0eop4zs3tdzdr"},{"@type":"ListItem","position":3,"name":"TS7 AST: Reusable Parent-Child Guards Without Manual Intersections"}]}
```

