Skip to content

module: remove --experimental-transform-types#61803

Open
marco-ippolito wants to merge 1 commit intonodejs:mainfrom
marco-ippolito:rip-transform-type
Open

module: remove --experimental-transform-types#61803
marco-ippolito wants to merge 1 commit intonodejs:mainfrom
marco-ippolito:rip-transform-type

Conversation

@marco-ippolito
Copy link
Member

This PR removes the --experimental-transform-types flag and all related code, tests, and documentation.
It also changes the following user facing APIs:

  • stripTypeScriptTypes now only accepts the code to transform, and not the options object.
    It also does not add a sourceURL comment at the end of the transformed code.
  • process.features.typescript now only returns a boolean.
    Technically the stripTypeScriptTypes could have landed as a separate commit but I believe since it's a semver major commit it makes no difference.

Refs: nodejs/typescript#51

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/config
  • @nodejs/loaders
  • @nodejs/performance
  • @nodejs/startup
  • @nodejs/typescript

@marco-ippolito marco-ippolito added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 13, 2026
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Feb 13, 2026
@marco-ippolito marco-ippolito added module Issues and PRs related to the module subsystem. strip-types Issues or PRs related to strip-types support and removed c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Feb 13, 2026
This PR removes the `--experimental-transform-types`
flag and all related code, tests, and documentation.
It also changes the following user facing APIs:
- `stripTypeScriptTypes` now only accepts the code to transform,
   and not the options object.
   It also does not add a sourceURL comment at the
   end of the transformed code.
- `process.features.typescript` now only returns a boolean.
@GeoffreyBooth
Copy link
Member

process.features.typescript now only returns a boolean

I think we should add process.features.stripTypes that returns a boolean. This should be a separate PR so that it can be backported.

Then the question becomes what to do with process.features.typescript. I think having a feature called typescript only makes sense if the overall feature has various modes, like currently it's either off (false), strip or transform. But we might someday add other TypeScript-related features like type checking, or tsconfig.json support, or support for various features within tsconfig.json; and these might be individual features to be toggled on or off (like maybe a user enables tsconfig.json paths support but not type checking) and so a single string value for an overall mode doesn't make sense. We could make process.features.typescript a Record<string, boolean> so that there's something like process.features.typescript.strip === true and other features add onto there, or treat each new TypeScript-related feature as a top-level key on process.features.

For the purposes of this PR, perhaps the simplest thing to do would be to just keep process.features.typescript as it is but remove transform as a possible return type. Then a redesign of process.features.typescript can happen in a dedicated PR.

@marco-ippolito
Copy link
Member Author

User can run --no-strip-types so typescript might not be enabled

@aduh95
Copy link
Contributor

aduh95 commented Feb 13, 2026

  • process.features.typescript now only returns a boolean.

I wouldn't do that:

  • it's perfectly workable as is, as a string
  • if we end up re-introducing --transform-type or another type of typescript handling, it will put us in an awkard position.

Why risk it?

@styfle
Copy link
Member

styfle commented Feb 13, 2026

if we end up re-introducing --transform-type or another type of typescript handling, it will put us in an awkard position.

If we think thats a possibility in the future, then we should keep process.features.typescript as a string and also keep the options object in stripTypeScriptTypes() so we can allow strip but throw and error for other modes.

TLDR - keep this semver-major change as breaking only for those using transform but anyone using strip should not have a breaking change. Does that make sense?

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.67%. Comparing base (e687680) to head (c62af40).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/modules/typescript.js 83.33% 1 Missing ⚠️
src/compile_cache.cc 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61803      +/-   ##
==========================================
- Coverage   89.73%   89.67%   -0.06%     
==========================================
  Files         675      675              
  Lines      204676   204668       -8     
  Branches    39330    39281      -49     
==========================================
- Hits       183660   183536     -124     
- Misses      13293    13419     +126     
+ Partials     7723     7713      -10     
Files with missing lines Coverage Δ
lib/internal/bootstrap/node.js 98.95% <100.00%> (-0.02%) ⬇️
src/compile_cache.h 100.00% <ø> (ø)
src/node_options.cc 76.20% <ø> (-0.08%) ⬇️
lib/internal/modules/typescript.js 91.39% <83.33%> (-6.09%) ⬇️
src/compile_cache.cc 79.15% <0.00%> (-1.63%) ⬇️

... and 50 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GeoffreyBooth
Copy link
Member

This PR's goal is to remove transform-types. So in this PR, I think just remove the transform response from process.features.typescript. Any other rethinking or redesign of that property can come in a follow-up PR.

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

Labels

module Issues and PRs related to the module subsystem. semver-major PRs that contain breaking changes and should be released in the next major version. strip-types Issues or PRs related to strip-types support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants