Skip to content

build(deps-dev): upgrade TypeScript to 7 and replace ts-node with tsx - #163

Merged
cawalch merged 1 commit into
mainfrom
build/typescript-7
Nov 1, 2026
Merged

cawalch merged 1 commit into
mainfrom
build/typescript-7

Conversation

@cawalch

@cawalch cawalch commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Adopt TypeScript 7 (the native compiler) and replace the one tool that cannot follow it. tsdown emits declarations through rolldown-plugin-dts; ts-node loads the TypeScript compiler API, which TypeScript 7 no longer exposes.

• Bump typescript from 5.9.3 to ^7.0.2.
• Replace ts-node with tsx for npm run dev. tsx transpiles with esbuild and does not touch the TypeScript API, so it keeps working with TS 7.
• Rename scripts/gh-pages-publish.js to .cjs and run it with plain node. The script uses require() inside a type: module package, so .cjs is the correct extension; this removes the last ts-node usage.
• Re-add esbuild to allowScripts, since tsx installs it and its postinstall is reviewed.
• No source changes: the upgrade is entirely toolchain.

Verification

On Node.js 26.13.0:

  • npm run build — produces the same 26 files as before; npm test -- test/build-artifacts.spec.ts — 21/21 passed (CJS/ESM interop, IIFE global, declarations, shebang).
  • npm test — 1,380 tests passed; npm run coverage unchanged at statements 95.66%, branches 91.93%, functions 95.83%, lines 95.54%.
  • npm run lint:ci — passes.
  • npm run dev -- --help — the CLI starts under tsx.
  • node --check scripts/gh-pages-publish.cjs — syntax valid.
  • npm audit and osv-scanner — 0 findings.

The CI matrix (22.x/24.x/26.x), OSV workflows, and verify-lockfile run on this pull request.

Note

npx tsc --noEmit still reports Cannot find name 'process' / 'console' in src/cli.ts. That predates this change: the project has no @types/node, and the check is not part of CI. Adding @types/node plus a tsc --noEmit step would make a real typecheck available; left as a separate change to keep this one about the compiler upgrade.

tsdown can emit declarations with the native compiler; ts-node cannot, because TypeScript 7 no longer ships the compiler API it loads.

• Bump `typescript` to `^7.0.2`; declarations are generated through tsdown's `rolldown-plugin-dts` tsgo backend.
• Replace `ts-node` with `tsx` for the `dev` script; tsx transpiles with esbuild and does not depend on the TypeScript compiler API.
• Rename `scripts/gh-pages-publish.js` to `.cjs` and run it with `node`, since the script is CommonJS inside a `type: module` package; this removes the last ts-node usage.
• Re-add `esbuild` to `allowScripts` for tsx's install script.
@cawalch
cawalch merged commit 4cc704e into main Nov 1, 2026
9 checks passed
@cawalch
cawalch deleted the build/typescript-7 branch November 1, 2026 16:40
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