PostHog / PostHog/posthog

Track upstream TypeScript 7 (tsgo) APIs needed for kea-typegen migration

Open
#59,093 2 comments 0 reactions 1 assignee View on GitHub

@gantoine is already working on this.

Since May 19, 2026.

Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Context

PR #59070 wires @typescript/native-preview (tsgo) as a shadow type-checker alongside tsc, with typescript@6.0.3 retained via pnpm.overrides for every tool that consumes the programmatic Compiler API. The largest such consumer is kea-typegen, which generates the *Type.ts files we depend on for kea logic typing.

This issue tracks the upstream gaps that block migrating kea-typegen (and the rest of our programmatic-API consumers) off typescript@6.

Why this is blocked today

@typescript/native-preview currently ships zero JS-callable codepackage.json has no main/types, only a bin entry that subprocesses the native binary. The "Corsa" IPC API exists in microsoft/typescript-go source (_packages/native-preview/src/api/sync/api.ts) but is not bundled to npm.

Even once Corsa ships, kea-typegen's hot path needs APIs that aren't designed yet:

  • ts.factory.* — kea-typegen constructs *Type.ts AST nodes
  • ts.createPrinter — serializes constructed nodes to text
  • checker.typeToTypeNode — converts a resolved Type back into a printable TypeNode
  • checker.typeToString, checker.getExportsOfModule — listed as gaps, no open PR

There is also an architectural mismatch: kea-typegen holds live ts.Node references across many checker calls and mutates the AST in-memory. Corsa is IPC: opaque handles, serialize/deserialize per call. No in-process AST graph.

Upstream issues to watch

  • microsoft/TypeScript#63771 — Transformer Plugin or Compiler API (open, no timeline)
  • microsoft/TypeScript#63800 — API usage patterns for complex editor extensions (Corsa design)
  • microsoft/typescript-go#3610 — API: additional Checker methods for transpiler consumers (subset of methods landing incrementally; typeToTypeNode is a listed gap)
  • microsoft/typescript-go#3616 — API emit support (open PR, not merged)

Definition of done

  • @typescript/native-preview (or a Microsoft-blessed sibling package) ships a JS-importable module with: ts.factory, ts.createPrinter, ts.createSourceFile, Program.getTypeChecker(), TypeChecker.typeToTypeNode, TypeChecker.typeToString, TypeChecker.getExportsOfModule, and the ~40 ts.is* AST predicates kea-typegen relies on.
  • kea-typegen's peerDependencies.typescript is bumped to support the 7.x line.
  • We drop the pnpm.overrides.typescript = "6.0.3" pin and rely on the catalog entry only.
  • Same applies to other API consumers we currently pin: ts-jest, ts-node, ts-json-schema-generator, @parcel/packager-ts, @parcel/transformer-typescript-types.

Realistic timeline

TS 7.1 at the earliest, more likely 7.2+. Microsoft has not committed to a date. No engineering action is feasible until upstream lands the APIs above — this is a watch-list, not a backlog item.

Related

  • PR #59070 — adds the tsgo shadow CI step and the coexistence setup this issue depends on.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.