Skip to the page

Modern Node in 2026 · mid

Running TypeScript directly in Node

Current Node runs .ts files directly by stripping type annotations (on by default since 23.6 and 22.18, stable since 24.12 and 25.2), but it does not type-check, ignores tsconfig, and only supports erasable syntax, so enums, namespaces with code and parameter properties fail.

The notes

What you must know

  • node app.ts works in Node 24 and 26 with no flags. Types are replaced with whitespace, so line numbers stay correct without source maps.
  • No type checking: run tsc --noEmit (TypeScript 7's native compiler is fast) in CI and the editor.
  • Not supported: enum, namespace with runtime code, parameter properties (constructor(private db: Db)), import = aliases; decorators are a parse error. These throw ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX. --experimental-transform-types was removed in Node 26. Turn on "erasableSyntaxOnly" in tsconfig to catch them early.
  • Imports need the real extension (import './db.ts'), and type-only imports need import type ("verbatimModuleSyntax": true helps). "rewriteRelativeImportExtensions" lets tsc emit .js imports for publishing.
  • tsconfig is ignored (no paths aliases, no downlevelling). Files inside node_modules are never stripped, so libraries must publish JavaScript.
  • Alternatives when you need full TypeScript features or path aliases: tsx, or a bundler such as esbuild or tsup.

The red pen

Common traps: mistake → fix

  • Mistake: Node now type-checks TypeScript

    Fix: it only removes types; code with type errors still runs.

  • Mistake: Any TypeScript file runs

    Fix: enums, parameter properties and runtime namespaces throw ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX.

  • Mistake: Publish .ts files to npm and Node will run them

    Fix: Node refuses to strip files under node_modules.

Easy to hard

Questions interviewers ask, easy to hard

  1. Can Node run TypeScript directly now? What exactly does it do?
  2. Which TypeScript features do not work, and why?
  3. How would you set up a new TypeScript Node service in 2026?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview