Node.js Gains Experimental Native TypeScript Support
Node.js merged PR #53725, introducing the --experimental-strip-types flag that lets developers run TypeScript files directly by transpiling them to JavaScript without type checking, while outlining current limitations such as missing enum and namespace support, .ts file handling, and source‑map absence.
Node.js recently merged PR #53725 which adds an experimental flag --experimental-strip-types. When this flag is enabled, Node.js can execute .ts files directly, automatically transpiling the TypeScript source to JavaScript without performing any type checking, so no external transpilation dependencies are required.
For example, running node index.ts on the following TypeScript code: const foo: string = "foo"; produces the JavaScript output: const foo = "foo"; The transpilation process discards all type information, and certain TypeScript‑only features such as enum and namespace are not supported at this stage.
The implementation relies on the @swc/wasm-typescript package, a lightweight wasm bundle that provides the binding needed for the conversion. This package is also used by Deno and has been tested in production scenarios.
Current limitations include:
Unsupported TypeScript features that require transformation, such as enums and namespaces.
.ts files cannot be imported with a .js extension.
TypeScript files inside node_modules cannot be executed.
No source‑map support; the runtime replaces removed code with spaces to keep original stack traces, referencing the related sourcemap discussion.
This PR represents the first step toward experimental TypeScript support; further work is outlined in the experimental TS support roadmap linked in the references.
References:
PR #53725: https://github.com/nodejs/node/pull/53725
Sourcemaps issue: https://github.com/nodejs/node/pull/53725#issuecomment-2209238883
Experimental TS support roadmap: https://github.com/nodejs/loaders/issues/217
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Full-Stack Cultivation Path
Focused on sharing practical tech content about TypeScript, Vue 3, front-end architecture, and source code analysis.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
