You can run node app.ts with no loader and no build step, and Node.js type stripping is now officially stable. That does not mean tsx and ts-node are obsolete overnight. Node only erases types; it does not compile TypeScript. This post covers what changed, which syntax breaks, and how to migrate an existing project.
What changed: from experimental flag to stable type stripping
According to the Node.js TypeScript docs, the feature moved through these steps:
| Version | Change |
|---|---|
| v22.6.0 | Type stripping added behind a flag |
| v22.7.0 | --experimental-transform-types added |
| v22.18.0, v23.6.0 | Enabled by default |
| v22.18.0, v24.3.0 | Experimental warning removed |
| v24.12.0, v25.2.0 | Declared stable |
| v26.0.0 | --experimental-transform-types removed |
The last row is the one that matters for migration. If you relied on the transform flag to run enums or parameter properties, that escape hatch no longer exists on Node 26. If you are moving up, see Node.js 26 LTS: What Changed and How to Upgrade from Node 24.
What Node actually does to your .ts file
Node replaces inline type annotations with whitespace and runs the result. It performs no type checking, so errors only show up in tsc or your editor. Because the types become whitespace, line and column numbers in stack traces stay correct, and no source maps are generated.
// greet.ts
function greet(name: string): string {
return `Hello, ${name}`;
}
console.log(greet(42 as any));
Run it with node greet.ts. Node also ignores tsconfig.json entirely, and the built-in parser needs WebAssembly. To turn the feature off, pass --no-strip-types.
Syntax that fails and its erasable replacement
Only syntax that can be erased works. Per the docs, these need transformation and fail with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX: enum, namespace with runtime code, parameter properties, import aliases, and decorators. Type-only namespaces are fine, and .tsx is unsupported.
Enums
// Fails
enum Role { Admin, User }
// Works
const Role = { Admin: 'admin', User: 'user' } as const;
type Role = (typeof Role)[keyof typeof Role];
Parameter properties
// Fails
class UserService {
constructor(private repo: Repo) {}
}
// Works
class UserService {
private repo: Repo;
constructor(repo: Repo) {
this.repo = repo;
}
}
Runtime namespaces
Replace namespace A { export let x = 1 } with a plain module that exports x.
Imports: extensions, import type and subpath imports
Three rules trip people up:
- Extensions are mandatory. Write
import './file.ts', not'./file'. This also applies torequire()and dynamicimport(). - Type imports need the
typekeyword. Without it Node treats them as value imports and fails at runtime. - No
pathsaliases. Use subpath imports inpackage.json, which must start with#.
import { fn, type FnParams } from './fn.ts';
import type { User } from './types.ts';
{
"type": "module",
"imports": {
"#db/*": "./src/db/*"
}
}
Module format follows the usual rules: .ts follows the nearest package.json type, .mts is always ESM, and .cts is always CommonJS.
tsconfig settings that keep tsc and Node in agreement
Node does not read your tsconfig, so use it to make the compiler reject what Node would reject. The docs recommend TypeScript 5.8 or newer with:
{
"compilerOptions": {
"noEmit": true,
"target": "esnext",
"module": "nodenext",
"rewriteRelativeImportExtensions": true,
"erasableSyntaxOnly": true,
"verbatimModuleSyntax": true
}
}
erasableSyntaxOnly flags enums and parameter properties at edit time. verbatimModuleSyntax catches missing type keywords. Add noEmit only if you execute the .ts files directly rather than shipping .js.
Migration checklist from tsx or ts-node
- Upgrade to a version where it is stable: Node 24.12+, 25.2+ or 26.
- Enable
erasableSyntaxOnlyandverbatimModuleSyntax, then fix every error. - Rewrite extensionless relative imports to include
.ts. - Replace
pathsaliases with#subpath imports. - Add a separate
tsc --noEmitstep to CI, since Node will not type check. - Change scripts from
tsx src/index.tstonode src/index.tsand run your tests, for example with the built-in test runner.
When you should still use tsx or a build step
- You need enums, decorators or parameter properties and do not want to rewrite them.
- You depend on
tsconfigfeatures such aspathsor downleveling. - You use
.tsxfiles. - You publish a package: Node refuses to strip types inside
node_modules, so ship compiled JavaScript.
The docs themselves point to tsx for full TypeScript support, for example node --import=tsx file.ts.
Conclusion
Node.js type stripping is a good fit for services, scripts and tools where you control the code. Turn on erasableSyntaxOnly, keep type checking in CI, and keep tsx in reserve for the cases above. The migration is mostly mechanical, and the compiler flags tell you exactly what to change.





