Skip to content

Evaluate TypeScript 7 (native tsgo compiler) adoption #243

Description

@mellonis

Tracking issue for evaluating TypeScript 7 (the native tsgo-based compiler) adoption across this repo. Umbrella for splitting the work into separate PRs, per the probe findings below.

Summary

Probed typescript@7.0.1-rc against this repo's real gates (npm run build, npm run typecheck, npm run lint, npm test) in an isolated worktree. Nothing from the probe landed.

Verdict: not adoptable today. build and typecheck are one config line away from green; lint hard-crashes on a structural incompatibility that is entirely upstream-blocked (typescript-eslint).

What works

  • tsc --build (project references + declaration emit) and tsc --noEmit typecheck: both pass cleanly under TS 7.0.1-rc once moduleResolution is changed away from the now-removed "node" (node10) mode. Confirmed with "bundler"; "nodenext"/"node16" may be more appropriate for a published library and should be evaluated as an alternative.
    • dist/ output: file list is byte-identical to the TS 6.0.3 baseline (70 files, same paths). Content is byte-identical for 67/70 files; the other 3 differ only cosmetically (helper-declaration ordering in one .js file; an empty declare namespace id {} correctly dropped from one .d.ts; an accessor pair rendered as get/set instead of collapsed to a plain property in another .d.ts — all non-breaking).
    • Verified this config fix is TS-version-independent: re-tested moduleResolution: "bundler" under the current baseline typescript@6.0.3build, typecheck, lint, and test all pass. So this is a standalone hygiene fix, not a TS7-only workaround.
  • npm test (Vitest): completely unaffected either way — Vitest uses esbuild for TS transforms, never touches the typescript package. 30 files / 664 tests pass under both TS6 and TS7.

What's blocked

  • npm run lint (ESLint 10.4.1 + typescript-eslint 8.60.1) hard-crashes under TS 7.0.1-rc — not a warning, a fatal Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in node_modules/typescript/package.json.
    • Root cause: the typescript npm package at 7.0.1-rc ships no root . export, no main, no types in its package.json — only ./unstable/* entries (./unstable/sync, ./unstable/async, ./unstable/fs, ./unstable/ast*, etc.). Any tool doing the classic require('typescript') (which is what @typescript-eslint/typescript-estree does) fails outright at the Node module-resolution layer.
    • typescript-eslint declares typescript: ">=4.8.4 <6.1.0" as its peer range — checked against the currently-installed 8.60.1, the latest stable (8.62.1), and the latest alpha prerelease (8.62.2-alpha.11) via npm view typescript-eslint@<version> peerDependencies. All three declare the identical range. TS 7.0.1-rc is outside all of them, with no visible movement toward support as of this check. (Notably, typescript-eslint's own devDependencies already include @typescript/native-preview — they're dogfooding tsgo internally — but that hasn't produced a widened peer range yet.)
    • No repo-side workaround exists; this is 100% an upstream blocker.

CLI / packaging story

Installing the typescript package itself at 7.0.1-rc (not the standalone @typescript/native-preview package) makes npx tsc --version report 7.0.1-rc directly — tsc itself becomes the native compiler, no separate tsgo binary is present or needed. bin/tsc is a thin JS shim that execs a platform-specific native binary from an optionalDependencies package (confirmed as a genuine Mach-O arm64 executable on this machine). Per the package's own README: "For TypeScript 7.0 RC and later, use tsc just like for TypeScript 6.0. For other builds, use the tsgo command."

Recommended plan — split into separate PRs

  • PR 1 — config hygiene (landable now, under current TS 6.0.3): replace the removed moduleResolution: "node" setting in the root tsconfig.json with a supported mode ("bundler" confirmed working; evaluate "nodenext"/"node16" as the more library-faithful option). Drop the now-moot "ignoreDeprecations": "6.0" line once node10 is no longer referenced. Zero functional risk — verified green across build/typecheck/lint/test under TS 6.0.3.
  • PR 2 — typescript@7.x bump (blocked): gated on typescript-eslint publishing a TS7-compatible peer-dependency range. Do not bump CI's typescript install until then — bumping now would break the lint job. Track typescript-eslint's release notes / peer range for movement.
  • Cross-repo note: post-machine-js and machines-demo run the same ESLint + typescript-eslint + tsc toolchain and would hit the identical lint crash on a TS7 bump. The real gate is the single upstream typescript-eslint dependency shared by all three repos in this workspace — one unblock clears all three.

Full probe log

Preserved in the probe worktree at .superpowers-ts7-probe.md (not committed — experiment-only, per the task that produced it). Reproducing the key data points above is straightforward: npm install -D typescript@7.0.1-rc, then run the repo's four standard gates.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions