Node.js Now Runs TypeScript Natively Without a Build Step
Node.js can execute TypeScript files directly by stripping type annotations at load time, a feature enabled by default since version 23.6 and included in the 22.18 LTS release. The mechanism replaces type annotations with whitespace, preserving original line numbers in stack traces without requiring source maps. Only erasable syntax is supported in default strip mode; constructs like enums and namespaces with runtime code require a separate experimental transform flag backed by SWC. Node.js does not perform type checking and ignores tsconfig.json, so developers must still run tsc --noEmit in CI or pre-commit hooks. TypeScript 5.8's erasableSyntaxOnly compiler option helps enforce compatibility by turning any non-erasable construct into a compile-time error.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in