Skip to main content
Piotr Majkutewicz
Back to Blog

Node.js 23: Run TypeScript Without Configuration

Node.js 23 introduces native support for running TypeScript files without additional configuration. This update simplifies development and reduces setup time for TypeScript projects.

How It Works

  • Create `.ts` files containing TypeScript syntax.
  • Run them directly using node index.ts without extra flags.
  • Node.js strips out type annotations using SWC and executes the result.

Type Checking

Node.js does not perform type checking at runtime. You still need to run tsc --watch to check types while developing.

Recommended tsconfig.json

json
{
  "compilerOptions": {
    "esModuleInterop": true,
    "skipLibCheck": true,
    "target": "es2022",
    "allowJs": true,
    "resolveJsonModule": true,
    "moduleDetection": "force",
    "isolatedModules": true,
    "verbatimModuleSyntax": true,
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "noImplicitOverride": true,
    "allowImportingTsExtensions": true,
    "rewriteRelativeImportExtensions": true,
    "module": "NodeNext",
    "noEmit": true,
    "lib": ["es2022"]
  }
}

Production Considerations

  • For serverless deployments, transpiling and minifying is recommended.
  • npm libraries should still be transpiled to ensure compatibility.
  • Monorepos benefit from `.d.ts` files for improved TypeScript performance.

Will It Be Backported?

Yes, but only to Node.js 22. Node.js 20 will not receive this update.

Key Takeaways

  • Run TypeScript files natively with Node.js 23.
  • No runtime type checking – use tsc --watch.
  • Transpilation is still required for production use cases.