Skip to content

Migrate type-checking and declaration build to TypeScript v7#8805

Open
pubkey wants to merge 2 commits into
masterfrom
claude/typescript-v7-migration-qigblx
Open

Migrate type-checking and declaration build to TypeScript v7#8805
pubkey wants to merge 2 commits into
masterfrom
claude/typescript-v7-migration-qigblx

Conversation

@pubkey

@pubkey pubkey commented Jul 17, 2026

Copy link
Copy Markdown
Owner

This PR contains

  • IMPROVED typings / build tooling (TypeScript v7 migration)
  • SOMETHING ELSE (build-toolchain change, no source code behavior change)

Describe the problem you have without this PR

The project type-checked, generated its shipped .d.ts files and ran the public typings test on TypeScript v5. This PR moves that pipeline to the native TypeScript v7 compiler (typescript@7.0.2).

The constraint

The native v7 typescript package only ships the new ./unstable/* API. It no longer exposes the classic compiler API (ts.createProgram, ts.Extension, etc.) that typescript-eslint and ts-loader rely on. As of today no released typescript-eslint supports the v7 native API (latest still pins typescript >=4.8.4 <6.1.0), and swapping the top-level typescript to v7 crashes npm run lint at load (Cannot read properties of undefined (reading 'Cjs')) and would break the landingpage ts-loader build.

The approach

Run a dual setup during the transition:

  • The classic typescript@5.9.3 stays as the top-level typescript dependency, used only by typescript-eslint and ts-loader through node module resolution.
  • The native v7 compiler is added as an aliased typescript7 (npm:typescript@7.0.2) dependency and invoked by explicit path from a new tsc7 script (its own tsc bin name collides with the classic one).
  • check-types, build:types and test:typings now run on v7.

Config adjustments required by v7

  • config/tsconfig.types.json: set rootDir: "../src" explicitly. v7 no longer infers the common source directory and otherwise errors with TS6059/TS5011.
  • test:typings: added --ignoreConfig. v7 errors (TS5112) when files are passed on the command line while a tsconfig.json is present; older tsc silently ignored the config in that case.

Verification

  • npm run check-types (v7): passes, 0 errors
  • npm run build including build:types (v7): passes
  • npm run test:typings (v7): passes, 0 errors
  • npm run lint (classic v5 for typescript-eslint): passes
  • npm run test:fast:memory: 1072 passing (the single unrelated failure is replication-webrtc.test.ts, whose node-datachannel native addon cannot be compiled in this sandbox; independent of TypeScript)
  • The v7 declaration emit was diffed against the v5 output and is semantically identical. The only differences are union-member ordering (1 | -1-1 | 1), quote style ("x"'x') and any | undefinedany on optional params.

Todos

  • Tests
  • Documentation
  • Typings
  • Changelog

🤖 Generated with Claude Code

https://claude.ai/code/session_01NME9TqXAZuxvVbji4vSK5G


Generated by Claude Code

claude added 2 commits July 17, 2026 13:54
Run check-types, the .d.ts declaration build and the public typings test
on the native TypeScript v7 compiler (typescript@7.0.2).

The native v7 `typescript` package only ships the new `./unstable/*` API and
no longer exposes the classic compiler API that typescript-eslint and
ts-loader depend on. To keep lint and the landingpage webpack build working,
the classic typescript@5.9.3 is kept as the top-level `typescript` dependency
(used only by those tools via node module resolution) while the v7 compiler is
added as an aliased `typescript7` dependency and invoked by explicit path from
the `tsc7` script.

Changes:
- add `typescript7` (npm:typescript@7.0.2) and a `tsc7` helper script
- point `check-types`, `build:types` and `test:typings` at the v7 compiler
- set `rootDir` explicitly in config/tsconfig.types.json, required by v7
- pass `--ignoreConfig` in `test:typings` since v7 errors when files are
  given on the command line while a tsconfig.json is present

The v7 declaration emit was verified to be semantically identical to the v5
output (differences are only union-member ordering, quote style and
`any | undefined` vs `any` on optional params).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NME9TqXAZuxvVbji4vSK5G
Upgrade @typescript-eslint/parser and @typescript-eslint/eslint-plugin
from 8.63.0 to the latest stable 8.64.0.

Note: this does not remove the dual-TypeScript setup. Even the latest
typescript-eslint still requires the classic compiler API (peer
`typescript >=4.8.4 <6.1.0`) and does not yet support the TypeScript v7
native API, so typescript@5.9.3 stays as the lint-only TypeScript.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NME9TqXAZuxvVbji4vSK5G
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants