Skip to content

chore(typescript): move the typescript package to 7.0.2 and drop the @typescript/native alias #644

Description

@jasonhnd

Series

Part of #635. Order 8. Blocked by order 7 (#643) merged to preview. Requires #636 (TOOLCHAIN §4 rule lifted by owner ruling 2026-09-24 「A」).

Why

Today package.json carries two TypeScripts:

  • "typescript": "^6.0.3" — installed, used by nothing: no file imports the TypeScript JS API (grep -rn "from ['\"]typescript['\"]\|require(['\"]typescript" scripts src api → no hits), no package declares typescript as a dependency or peer in bun.lock.
  • "@typescript/native": "npm:typescript@^7.0.2" — the alias that actually runs typecheck (node node_modules/@typescript/native/bin/tsc --noEmit).

The owner ruled (2026-09-24, 「A」) to collapse this to one package now instead of waiting for 7.1. typescript@7.0.2 is the native (Go) compiler: bin/tsc is a Node shim that execs a platform binary from an optional dependency (@typescript/typescript-<os>-<arch>@7.0.2; bun.lock records all 20 platforms including @typescript/typescript-linux-x64 for CI/Vercel). It also exports unstable/* API entry points, which nothing here uses.

Editor note (not a blocker): VS Code's built-in TS server does not use this package's tsserver; TS 7 ships its own language server. Nothing in the repo configures typescript.tsdk (.vscode/ does not exist).

Dry run 2026-09-24 (throwaway worktree: preview 9b4e7197 + orders 1–7 applied, Bun 1.4.2, Node 24.20.0, no PUBLIC_* env)

Step Result
edits below → bun install "Removed: 1"; lockfile now has only typescript@7.0.2 (+ its platform packages); grep -c "@typescript/native" bun.lock = 0; lockfileVersion 1; diff = package.json (+2 / −3), bun.lock
rm -rf node_modules && bun install --frozen-lockfile OK; node_modules/@typescript/ holds only typescript-darwin-arm64
node node_modules/typescript/bin/tsc --version Version 7.0.2
bun run typecheck exit 0 (≈0.4 s wall)
probe: add src/__tc_probe.ts with export const probe: number = "not a number"; bun run typecheck exit 1, error TS2322 — the new path really type-checks. Probe removed → exit 0
test / build / REQUIRE_BUILT_ARTIFACTS / verify:gates all OK
bun x playwright test --reporter=line 356 passed, 26 skipped, 0 failed

やること

  1. Branch chore/typescript-7 from origin/preview (order 7 merged).
  2. package.json:
    • scripts.typecheck: node node_modules/@typescript/native/bin/tsc --noEmit → node node_modules/typescript/bin/tsc --noEmit
    • devDependencies: delete "@typescript/native": "npm:typescript@^7.0.2"; change "typescript": "^6.0.3" → "typescript": "^7.0.2".
  3. bun install, then:
    grep -c '@typescript/native' bun.lock                          # 0
    grep -o '"typescript@[0-9.]*"' bun.lock | sort -u               # only "typescript@7.0.2"
    grep -c '"@typescript/typescript-linux-x64@7.0.2"' bun.lock     # 1 (CI / Vercel binary)
    grep -n 'lockfileVersion' bun.lock                              # 1
    rm -rf node_modules && bun install --frozen-lockfile
    node node_modules/typescript/bin/tsc --version                  # Version 7.0.2
  4. Prove the check still bites (do not commit the probe):
    echo 'export const probe: number = "not a number";' > src/__tc_probe.ts
    bun run typecheck; echo "exit=$?"     # exit=1 with error TS2322
    rm src/__tc_probe.ts
    bun run typecheck; echo "exit=$?"     # exit=0
  5. Standard chain:
    unset PUBLIC_GA4_MEASUREMENT_ID PUBLIC_X_PIXEL_ID PUBLIC_META_PIXEL_ID
    bun run test && bun run build
    REQUIRE_BUILT_ARTIFACTS=1 bun test scripts/home-css-loading.test.ts src/site/models-built.test.ts
    bun run verify:gates
    bun x playwright test --reporter=line
    git diff --exit-code
    grep -rn "@typescript/native" --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=dist-astro --exclude-dir=.cache .   # only historical TOOLCHAIN text may remain (see step 6)
  6. Docs in the same PR:
    • docs/TOOLCHAIN.md §2: typescript (JS package) row **6.0.3** → **7.0.2** (native compiler; platform binary via optional deps); typecheck binary row → `typescript` **7.0.2** via `node node_modules/typescript/bin/tsc --noEmit` (the `@typescript/native` alias was removed in #635 order 8). §11 order 8 done + PR number. Leave §4's historical text as docs(toolchain): record the 2026-09 upgrade queue, fix §2/§6/§7 drift, and allow typescript 7 #636 rewrote it.
    • CHANGELOG.md ### Changed: - **typescript 6.0.3 → 7.0.2; @typescript/native alias removed** — typecheck now runs node_modules/typescript/bin/tsc (owner ruling 2026-09-24).

やらないこと

  • No tsconfig.json change. No source changes to satisfy new diagnostics — if TS 7.0.2 reports anything the alias did not, stop and report (it should not: same compiler binary).
  • Do not add @typescript/native back under another name. Do not add a .vscode/ config.
  • No other package bumps.

Acceptance

  • package.json: typescript ^7.0.2, no @typescript/native, new typecheck script.
  • bun.lock: no @typescript/native, single typescript@7.0.2, linux-x64 binary present, lockfileVersion: 1.
  • Probe proof pasted (exit 1 with TS2322, then exit 0).
  • Step 5 chain green; quality "Run typecheck" step green on Linux.
  • Vercel green (its buildCommand runs bun run typecheck). TOOLCHAIN §2/§11 + CHANGELOG updated.

Branch / PR

chore/typescript-7 → base preview, Closes #644.

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

    delivery:unitloopcoder work unitenhancementNew feature or requestrisk:medmedium risk work itemtier:2tier 2 work item

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions