Skip to content

chore: upgrade TypeScript to 5.9.3 and enable .ts imports#3043

Open
bennypowers wants to merge 5 commits intomasterfrom
node24/typescript-upgrade
Open

chore: upgrade TypeScript to 5.9.3 and enable .ts imports#3043
bennypowers wants to merge 5 commits intomasterfrom
node24/typescript-upgrade

Conversation

@bennypowers
Copy link
Member

Summary

  • Upgrade TypeScript from ~5.0.4 to ^5.9.3
  • Enable module: nodenext and rewriteRelativeImportExtensions in tsconfigs
  • Rewrite all relative imports from .js to .ts extensions (~200 source files)
  • Add type keyword to type-only imports
  • Remove TypeScript parameter properties from constructors (DevServer, PluginSyntaxError, WebSocketsManager)
  • Update eslint (^8.57.1), prettier (^3.7.1), and @typescript-eslint (^8.48.0)
  • Fix internal-ip CJS interop for nodenext module resolution
  • Add @ts-ignore for deprecated puppeteer accessibility API

Zero runtime behavior change — output remains CJS. This is PR 1 of 4 in the Node 24 migration stack.

Stack

  1. This PR — TypeScript upgrade + .ts imports
  2. node24/test-migration — mocha/chai → node:test migration
  3. node24/esm-and-node24 — CJS→ESM + Node 24 requirement
  4. node24/parse5-and-jsdoc — parse5 v8 + JSDoc→TS conversions

Test plan

  • npm run build passes with zero TS errors
  • Build output verified as CJS (no runtime behavior change)
  • CI passes

🤖 Generated with Claude Code

- Upgrade TypeScript from 5.0.4 to 5.9.3
- Update eslint, prettier, and related dev dependencies
- Enable `module: nodenext` and `rewriteRelativeImportExtensions` in tsconfigs
- Rewrite all relative imports from .js to .ts extensions
- Add `type` keyword to type-only imports across source files
- Remove TypeScript parameter properties from constructors
  (DevServer, PluginSyntaxError, WebSocketsManager)
- Fix internal-ip CJS interop for nodenext module resolution
- Add @ts-ignore for deprecated puppeteer accessibility API

Zero runtime behavior change — output remains CJS.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 16, 2026

⚠️ No Changeset found

Latest commit: c261ccf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

prettier-plugin-package v1.x requires prettier ^2, which conflicts
with our upgrade to prettier ^3.7.1. v2.0.0 supports prettier ^3.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@typescript-eslint v8 enables stricter rules by default. Disable rules
that flag pre-existing code patterns:
- no-require-imports: CJS require() in .js files
- no-unused-expressions: chai expect() assertions in tests
- no-empty-object-type: {} type usage
- no-unsafe-function-type: Function type usage
- no-unused-vars: allow unused catch parameters

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TS 5.9 with module:nodenext requires explicit return type annotation
when the inferred type references a non-portable path (TS2742).

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Extensions

TypeScript's rewriteRelativeImportExtensions injects a
__rewriteRelativeImportExtension helper into the output. This helper
is not needed in browser bundles and breaks test execution.

Add stripRewriteImportExtensionPlugin to remove the helper from the
rollup output. Also add resolveMochaPlugin for robust monorepo
module resolution.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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