Skip to content

feat(deps): upgrade to TypeScript 7 via the official alias pair - #67

Merged
stuffbucket merged 1 commit into
mainfrom
feat/typescript-7
Sep 7, 2026
Merged

stuffbucket merged 1 commit into
mainfrom
feat/typescript-7

Conversation

@stuffbucket

Copy link
Copy Markdown
Owner

The other half of the language group from #37. Depends on nothing else; #60
carries @types/node separately.

Why a bare bump does not work

TypeScript 7.0 ships no programmatic API. The package root exports
lib/version.cjs and nothing else — typeof ts.createProgram is undefined.
The API is planned for 7.1.

That breaks three things at once here:

  • seven files use the compiler API (find-casts.ts,
    provider-host-boundary.ts, maximal-electron's test helpers and scripts);
  • typescript-eslint reads ts.versionMajorMinor and refuses major ≥ 7;
  • knip 5 crashes calling into the stub.

The typescript-eslint failure is the dangerous one: install succeeds, tsc gets
faster, and lint silently stops running rules.

The fix is the configuration TypeScript documents for this gap

"@typescript/native": "npm:typescript@^7.0.2",
"typescript":         "npm:@typescript/typescript6@^6.0.2"

typescript resolves to the TS 6 compatibility package, which carries the full
compiler API; TS 7 arrives under an alias owning the tsc bin (TS 6 names its
own bin tsc6, so no collision). Typechecking runs on 7, everything needing the
API runs on 6 — the JS implementation of the same language version.

Nothing that consumes the compiler API changes. All seven files are
untouched, knip stays on 5, and typescript-eslint lands inside its peer range
instead of being refused.

Two real migrations

Change Why
types: ["bun"] in maximal, maximal-core TS 6/7 no longer auto-include it. Without it every node:* import and process/console fails in maximal, and maximal-core's declaration build fails on RequestInit, Response, AbortController, setTimeout. maximal-core's downstream tsconfigs keep types: [] and are unaffected — they do not extend it.
ignoreDeprecations: "6.0" in the six tsup-dts packages tsup injects baseUrl, which TS 7 drops. None of these configs sets it themselves. Removable once tsup stops emitting it.

A wrong turn worth recording

My first attempt aliased TypeScript 5 for the API instead. It reached zero
typecheck errors and every lint passed — and it was wrong. pnpm gave
typescript-eslint the 5.9.3 copy, so tsc checked with 7 while the type-aware
lint rules checked with 5: two type systems judging the same code.

verify-workspace.mjs's "one typescript major" guard did not catch it,
because the alias installed under a different package name. That guard's own
comment records this exact class of failure from the last time this workspace
ran two majors — "made eslint-plugin-perfectionist call a TS 5 API on the TS 7
module"
. Under the official pair the guard is honest again: typescript
resolves to one major everywhere.

Verification

  • All nine packages typecheck and lint (type-aware rules confirmed running,
    not silently skipped).
  • maximal-core check:deep:host passes end to end — including knip 5, casts,
    deps, dupes, build, and the downstream contract typecheck.
  • Every tsup declaration build passes. (The container caught five packages I
    had missed by running only tsc --noEmit locally instead of the builds.)
  • Container suite 15/15 tasks; verify:workspace clean; lockfile
    re-resolved and stripped of rotating shard hosts.

TypeScript 7.0 ships no programmatic API -- the package root exports
lib/version.cjs and nothing else, and the API is planned for 7.1. Seven
files here use the compiler API, typescript-eslint reads
ts.versionMajorMinor and refuses major >= 7, and knip does the same kind
of thing, so a bare bump to 7 breaks all of them.

The upgrade is the configuration TypeScript documents for exactly this
gap:

  "@typescript/native": "npm:typescript@^7.0.2"
  "typescript":         "npm:@typescript/typescript6@^6.0.2"

`typescript` resolves to the TypeScript 6 compatibility package, which
carries the full compiler API, and TypeScript 7 arrives under an alias
that owns the `tsc` bin (TS 6 names its own bin tsc6, so they do not
collide). Typechecking runs on 7; everything that needs the API runs on
6, the JS implementation of the same language version.

Nothing that consumes the compiler API changes. find-casts.ts,
provider-host-boundary.ts, the maximal-electron test helpers and scripts,
typescript-eslint and knip 5 all keep working untouched, and
typescript-eslint lands inside its supported peer range rather than
being refused.

Two real migrations were needed:

  types: ["bun"] in maximal and maximal-core. TypeScript 6/7 no longer
  include it automatically. Without it every node:* import and every
  process/console reference fails to resolve in maximal, and
  maximal-core's declaration build fails on RequestInit, Response,
  AbortController and setTimeout. maximal-core's downstream
  tsconfigs keep types: [] and are unaffected -- they do not extend it.

  ignoreDeprecations: "6.0" in the six packages that generate
  declarations with tsup. tsup injects baseUrl, which TypeScript 7
  drops; none of these configs sets baseUrl themselves. Removable once
  tsup stops emitting it.

An earlier attempt aliased TypeScript 5 for the API instead. It reached
zero typecheck errors and every lint passed, and it was wrong: pnpm gave
typescript-eslint the 5.9.3 copy, so tsc checked with 7 while the
type-aware lint rules checked with 5. verify-workspace.mjs's one-major
guard did not catch it, because the alias installed under a different
package name -- the same class of failure its own comment records from
the last time this workspace ran two majors.

Verified: all nine packages typecheck and lint, maximal-core
check:deep:host passes end to end, every tsup declaration build passes,
the container suite is 15/15, and verify:workspace passes with the
lockfile re-resolved and stripped of rotating shard hosts.
@stuffbucket
stuffbucket merged commit 1a4535a into main Sep 7, 2026
7 checks passed
@stuffbucket
stuffbucket deleted the feat/typescript-7 branch September 7, 2026 04:29
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.

1 participant