DEV Community

AttractivePenguin
AttractivePenguin

Posted on

Node.js 24 Ships Native TypeScript: The End of Build Steps?

It is finally here. After years of requiring TypeScript compilation before execution, Node.js 24 lets you run .ts files directly. But does this mean you can throw away your bundler? Let dive in.


The Big Picture

Node.js 24 (recommended LTS as of March 2026) has landed with a feature that developers have wanted for over a decade: native TypeScript support. Using the --experimental-strip-types flag (now enabled by default for .ts files), you can execute TypeScript directly without any compilation step.

Combine this with npm v11 65% faster installations, and the JavaScript/TypeScript development workflow has fundamentally changed.

# Before: You needed this mess
npm install -D typescript ts-node esbuild
npx tsc
node dist/app.js

# Now: Just this
node app.ts
Enter fullscreen mode Exit fullscreen mode

That is it. That is the headline. But there is more nuance you need to understand.


How Native TypeScript Actually Works

The Mechanism: Type Stripping, Not Type Checking

When Node.js executes a TypeScript file directly, it does not perform type checking—that is still TypeScript job. Instead, Node uses a process called type stripping that removes all type annotations, interfaces, and type-only constructs before execution.

// app.ts - This is valid TypeScript
interface User {
  name: string;
  email: string;
  age: number;
}

function greet(user: User): string {
  return `Hello, ${user.name}!`;
}

const newUser: User = {
  name: "Sarah",
  email: "sarah@example.com",
  age: 28
};

console.log(greet(newUser));
Enter fullscreen mode Exit fullscreen mode

When Node.js 24 runs this, it internally transforms it to:

// What Node actually executes
function greet(user) {
  return `Hello, ${user.name}!`;
}

const newUser = {
  name: "Sarah",
  email: "sarah@example.com",
  age: 28
};

console.log(greet(newUser));
Enter fullscreen mode Exit fullscreen mode

Enabling Native TypeScript

Option 1: Automatic (Node.js 24+)

Just run your .ts file:

node app.ts
Enter fullscreen mode Exit fullscreen mode

Node.js automatically detects .ts extension and enables type stripping. No flags needed.

Option 2: Explicit Flag

node --experimental-strip-types app.ts
Enter fullscreen mode Exit fullscreen mode

Option 3: Package.json Configuration

{
  "name": "my-app",
  "type": "module",
  "scripts": {
    "start": "node --experimental-strip-types src/index.ts",
    "dev": "node --watch --experimental-strip-types src/index.ts"
  }
}
Enter fullscreen mode Exit fullscreen mode

Running TypeScript with ES Modules

If you are using ES modules (import/export syntax), it works seamlessly:

// utils/calculator.ts
export function add(a: number, b: number): number {
  return a + b;
}

export function multiply(a: number, b: number): number {
  return a * b;
}

// main.ts
import { add, multiply } from "./utils/calculator.js";

console.log("5 + 3 =", add(5, 3));
console.log("4 x 7 =", multiply(4, 7));
Enter fullscreen mode Exit fullscreen mode

Run it:

$ node main.ts
5 + 3 = 8
4 x 7 = 28
Enter fullscreen mode Exit fullscreen mode

Comparison: Traditional Build vs Native Execution

Development Workflow Comparison

Aspect Traditional Build Node.js 24 Native
First execution Compile then run Direct execution
Hot reload Rebuild + restart Node --watch
Type errors Build fails Still runs
Dependencies 5+ npm packages None extra
Startup time tsc + node Just node

The Real Speed Difference

Here a benchmark comparing workflows:

// benchmark.ts - Simple HTTP server
import http from "http";

const server = http.createServer((req, res) => {
  res.writeHead(200, { "Content-Type": "text/plain" });
  res.end("Hello from Node.js 24!\n");
});

server.listen(3000, () => {
  console.log("Server running at http://localhost:3000/");
});
Enter fullscreen mode Exit fullscreen mode

Traditional workflow (2025):

$ time npx tsc && node dist/benchmark.js
real    0m2.341s  # tsc compilation time
Enter fullscreen mode Exit fullscreen mode

Node.js 24 workflow (2026):

$ time node --watch benchmark.ts
real    0m0.089s  # Just Node startup
Enter fullscreen mode Exit fullscreen mode

The difference? ~26x faster startup in development.


Migration Guide: Existing Projects

Step 1: Install Node.js 24

# Using nvm (recommended)
nvm install 24
nvm use 24

# Verify
node --version
# v24.0.0
Enter fullscreen mode Exit fullscreen mode

Step 2: Update package.json

{
  "scripts": {
    "start": "node server.ts",
    "dev": "node --watch server.ts",
    "build": "tsc",
    "type-check": "tsc --noEmit"
  },
  "engines": {
    "node": ">=24.0.0"
  }
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Configure TypeScript for Production

You still need TypeScript compilation for production deployments:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "outDir": "./dist",
    "rootDir": "./src"
  }
}
Enter fullscreen mode Exit fullscreen mode

npm v11: The 65% Faster Installation

Node.js 24 ships with npm v11, which brings significant performance improvements.

Key improvements:

  • Parallel dependency resolution - dependencies install concurrently
  • Improved caching - smarter detection of cached packages
  • Reduced metadata overhead - less package.json parsing
# New npm 11 commands
npm install --parallel
npm install --prefer-offline
Enter fullscreen mode Exit fullscreen mode

Limitations and Caveats

What Native TypeScript Does NOT Do

  • No type checking at runtime - type errors silently pass
  • No type erasure at compile time - for production, you still need tsc
  • No JSX transformation - React JSX still needs Babel or a bundler
  • No CSS modules, asset imports - these still require a bundler

When to Keep Your Bundler

Use Case Native TypeScript Bundler Required
Backend API servers Yes Optional
CLI tools Yes Optional
Simple scripts Yes No
React/Vue frontend No Yes
Full-stack apps Partial Yes
Library publishing No Yes

Troubleshooting Common Issues

Error: ERR_UNKNOWN_FILE_EXTENSION

$ node app.ts
Error [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension: .ts
Enter fullscreen mode Exit fullscreen mode

Fix: Ensure you are using Node.js 24+:

node --version  # Must be v24.0.0 or higher
Enter fullscreen mode Exit fullscreen mode

Error: Cannot find module

Fix: Add .js extension for ESM compatibility:

import { helper } from "./utils/helper.js";
Enter fullscreen mode Exit fullscreen mode

Types Not Available at Runtime

Use type guards for runtime validation:

function isSuccess<T>(result: Result<T>): result is { success: true; data: T } {
  return result.success;
}
Enter fullscreen mode Exit fullscreen mode

FAQ

Q: Is Node.js 24 LTS now?
A: Yes, as of March 2026, Node.js 24 is the recommended LTS version.

Q: Can I delete TypeScript?
A: No! You still need it for type checking, declaration files, and production builds.

Q: Does this work with Deno?
A: Deno has had native TypeScript for years. This is Node.js catching up while maintaining npm compatibility.

Q: Can I use this in production?
A: For development: absolutely. For production, traditional builds with optimization are still recommended.

Q: Does this replace ts-node?
A: Yes, for most use cases. You can remove it from your dependencies.

Q: Can I use this with Docker?
A: Yes:

FROM node:24-slim
CMD ["node", "--experimental-strip-types", "src/index.ts"]
Enter fullscreen mode Exit fullscreen mode

Conclusion

Node.js 24 native TypeScript support is a game-changer for development workflows:

  • No more ts-node for simple execution
  • 65% faster npm installs with npm v11
  • Instant hot reload with --watch
  • Zero extra dependencies for TypeScript execution

Your move: Update to Node.js 24, remove ts-node from devDependencies, and enjoy the simpler workflow.

nvm install 24
nvm use 24
node --watch app.ts
Enter fullscreen mode Exit fullscreen mode

Welcome to 2026. The build step is (mostly) dead. Long live TypeScript.

Top comments (0)