Current Node runs .ts files by stripping the type annotations. No flag, no loader.
node app.ts
Type stripping is on by default in Node 22.18 and every 24 release. Node 22.6 to 22.17 need the flag:
node --experimental-strip-types app.ts
What it doesn’t do
Stripping removes annotations and does no type checking and no rewriting. Syntax that needs a real transform is rejected unless you add --experimental-transform-types:
enumnamespacewith runtime values- constructor parameter properties (
constructor(private x: number)) import x = require()
tsconfig.json is ignored entirely, so paths aliases don’t resolve and imports need the file extension, as ESM always did: import { a } from "./a.ts". Write the extension as .ts, not .js; the stripped file is served under its real name.
When to use tsx instead
tsx (the npm package) handles enums, path aliases and CommonJS interop, and works on any Node version. Use it for a project that already relies on those, and for scripts that have to run on older Node in CI.
npx tsx scripts/task.ts
For a new script with plain ESM and types only, bare node is enough and one dependency fewer.
Gotchas
node --testpicks up*.test.tsunder stripping, so the built-in runner works with no tooling.- Type errors still ship. Run
npx tsc --noEmitin CI; the runtime won’t tell you. - Shebang scripts work:
#!/usr/bin/env nodeat the top of a.tsfile, thenchmod +x.