Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Node.js Type Stripping: Run TypeScript Without a Build Step

Node.js can execute .ts files directly when they use erasable TypeScript syntax. Learn the version requirements, limits, import rules, and when to choose a runner such as tsx.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recent Node.js releases can run many .ts files directly, without a separate runtime transpiler. The built-in feature strips erasable TypeScript syntax; it does not check types, apply your tsconfig.json, or transform every TypeScript feature. It is stable in Node.js v24.12.0 and v25.2.0 and later in those release lines. Whether it fits your project depends on the syntax you use and how your modules and imports are written.

Run a TypeScript file directly

With a recent Node.js version, invoke the file as you would a JavaScript entry point:

As an Amazon Associate I earn from qualifying purchases.

node app.ts

Node.js says, “By default Node.js will execute TypeScript files that contains only erasable TypeScript syntax.” The feature was introduced in v22.6.0, enabled by default in v22.18.0 and v23.6.0, and became stable in v24.12.0 and v25.2.0. Check the current Node.js TypeScript documentation for version-specific details; older releases do not necessarily have the same default behavior. Node.js announced the default in v23.6.0 while the feature was still experimental in that release line (release announcement).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Node removes type annotations by replacing them with whitespace, preserving source positions without generating source maps. The result is executable JavaScript, not a compiled TypeScript build. You can also use supported TypeScript syntax with --eval or standard input when the relevant --input-type is set. TypeScript syntax is not supported in the REPL, --check, or inspect, and Node.js will not process TypeScript files inside node_modules.

What Node.js strips—and what it does not

The dividing line is whether TypeScript syntax can be erased while leaving valid JavaScript. Type annotations and type-only constructs that disappear at runtime fit this model. TypeScript 5.8 describes the boundary with its erasableSyntaxOnly compiler option (TypeScript 5.8 Release Notes).

Syntax that needs a transform

Node’s stripping-only mode does not generate runtime code for TypeScript features. The Node.js documentation calls out enums, namespaces with runtime code, parameter properties, and import aliases; TypeScript-specific import = and export = forms are also non-erasable examples. Decorators are not transformed and produce parser errors under the documented behavior. For these features, use a tool that performs the required transformation rather than expecting native stripping to compile them.

Type stripping is not type checking

Node.js removes type syntax but does not verify that values satisfy their declared types. If static validation is part of your workflow, run the TypeScript compiler separately, for example with npx tsc --noEmit when your project is configured for a no-output check. TypeScript describes its role as a static typechecker that runs before code executes (The TypeScript Handbook). The runtime shortcut and the checker solve different problems.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Imports and module rules still apply

Node.js supports CommonJS and ES module syntax in TypeScript files, but it does not convert one module system into the other. Module interpretation follows the corresponding JavaScript rules, so the file extension, package configuration, and import style must agree with the module system you intend to use.

Use runtime-resolvable extensions

For relative imports, write paths Node.js can resolve at runtime. A TypeScript source import can include its extension, for example:

import type { User } from './types.ts';
import { loadUser } from './load-user.ts';

The type modifier makes clear that User is needed only for checking. Without it, Node treats an import as a runtime value import, which may fail if the module does not provide that value. The verbatimModuleSyntax TypeScript option aligns the checker’s import handling with this behavior.

Do not expect tsconfig path aliases or downleveling

Node.js does not read tsconfig.json. It will not rewrite aliases configured with paths, and it will not transform newer JavaScript syntax to match an older target. Subpath imports are a documented runtime option for some aliasing needs, but their specifiers must start with #.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For authoring and checking, current Node.js guidance recommends TypeScript 5.8 or newer and lists target: "esnext", module: "nodenext", rewriteRelativeImportExtensions, erasableSyntaxOnly, and verbatimModuleSyntax as suitable settings. These are for the TypeScript toolchain, not runtime configuration for Node. noEmit is optional if the project only executes .ts files; it is unnecessary when you intend to produce distributable .js output.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose built-in stripping or a TypeScript runner

Built-in stripping is a good fit for scripts or applications that use erasable syntax, have runtime-resolvable imports, and do not rely on TypeScript transforms or compiler path rewriting. It removes the need for a separate runtime transpiler for that supported subset, while leaving static checking and any needed distribution build as separate choices.

If your project needs broader TypeScript syntax transformation or tsconfig.json behavior, use a third-party runner. Node.js documents tsx as one option; it is not the only available library.

Workflow Syntax coverage Configuration Separate step
Node.js built-in stripping Erasable TypeScript syntax; runtime-transform features such as enums and parameter properties are outside stripping-only support. Node ignores tsconfig.json; imports and modules must follow Node’s runtime rules. No separate runtime transpiler for supported syntax. Run a checker separately if you want static type validation.
Third-party runner such as tsx Use when your code needs TypeScript transforms beyond erasable syntax; confirm the chosen runner’s supported features. Node.js documents tsx for projects needing full TypeScript support and tsconfig.json behavior. Run through the tool, for example npx tsx your-file.ts or node --import=tsx your-file.ts. Type checking remains a distinct task unless your workflow explicitly performs it.
Compile with TypeScript Use the TypeScript compiler when you need emitted JavaScript output or compiler transforms. Compiler options are applied by TypeScript, not by Node’s native stripping. Compilation is a separate build step that produces JavaScript for Node.js to run.

Set up a practical direct-execution workflow

  1. Check your Node.js release. Use a release line with stable type stripping, such as Node.js v24.12.0 or later in the v24 line, or v25.2.0 or later in the v25 line.
  2. Run the entry point. Use node app.ts. If Node reports unsupported TypeScript syntax, identify whether the file uses a runtime transform feature before changing the code or tool.
  3. Make imports explicit. Include runtime-resolvable file extensions in relative imports and mark type-only imports with type.
  4. Keep checking separate. Add a TypeScript check such as npx tsc --noEmit if you want static type validation; Node’s direct execution does not provide it.
  5. Switch runners when needed. If the project depends on transforms or compiler configuration Node ignores, install tsx as a development dependency, then run npx tsx your-file.ts or node --import=tsx your-file.ts.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.