Node.js is able to execute TypeScript files without additional configuration
What Node’s TypeScript Support Actually Does
- Node 22.18 can load
.tsby stripping type syntax to whitespace and running the result as JavaScript. - No type checking is performed; types are treated like comments.
- Only the “erasable” subset of TypeScript works by default; features that emit JS (enums, parameter properties, namespaces, some decorators) are unsupported unless using experimental flags.
- Some commenters argue the title “execute TypeScript” is misleading since it’s effectively “execute TS-without-emitting-features.”
Benefits and Practical Use Cases
- Removes the need for a separate TS transpilation step in many workflows, especially for:
- Small scripts, CLIs, and maintenance helpers.
- Faster edit–run cycles during development.
- No sourcemaps are needed, which can simplify debugging and reduce runtime overhead.
- Node exposes a
stripTypeScriptTypesAPI, enabling “buildless” TS webapps by stripping types on the server before sending JS to the browser.
Limitations and Risks
- Type safety is unchanged; you must still run
tsc(or similar) in CI/editor, or you risk confusing runtime errors. - Some see it as a net negative: it may encourage running code without ever doing full type checks and push people to avoid useful TS-only features (enums, decorators, constructor properties).
- Node explicitly does not strip types in
node_modules, to discourage publishing TS-only packages; this disappoints people who wanted to depend on TS source directly. - Reports of breakage where tools like
ts-node/tsxnow accidentally hit Node’s more limited TS support.
Impact on TypeScript Usage
- Several think this reinforces a view of TS as “just a linter,” not a language with runtime semantics.
- Others lean into that: they prefer erasable-syntax-only TS so the source remains close to plain JS and avoids historical “regret” features.
Comparisons: Bun, Deno, Other Runtimes
- Many note Bun and Deno have supported TS execution “properly” for years and still offer better test runners and DX in some opinions.
- Counterpoints: Bun is seen as less stable/compatible and VC-dependent; Node is “boring,” foundation-backed, and the ecosystem baseline.
- Some say these competitors clearly pushed Node to improve.
Node’s Broader Trajectory
- Commenters list recent Node improvements: native
.envloading,--watch, built-in test runner, ESM syntax detection, permissions, better stdlib (undici, fs/promises), and now TS stripping. - Some feel Node + TS +
node:testis finally “usable by default”; others still find the ecosystem fragile and prefer Python, .NET, or Go.