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

Recent Node.js versions can run many .ts files directly, without a separate runtime transpiler. Node strips TypeScript syntax that can be erased while leaving valid JavaScript; it does not type-check your program, apply every TypeScript transform, or read tsconfig.json. Use it for code that fits those limits, and keep a separate checker or build step if your workflow needs one.

Which Node.js versions support direct TypeScript execution?

Node.js introduced type stripping in v22.6.0. It was enabled by default in v22.18.0 and v23.6.0, initially as an experimental feature. It became stable in v24.12.0 and v25.2.0. Check the current Node.js TypeScript documentation for the release history and behavior in your installed version; do not assume older releases have the same defaults.

Node.js describes the default behavior this way: “By default Node.js will execute TypeScript files that contains only erasable TypeScript syntax.” For a supported file, run it as you would a JavaScript entry point:

node app.ts

Node also supports TypeScript syntax with --eval and standard input when used with the appropriate --input-type. TypeScript syntax is not supported in the interactive REPL, --check, or inspect.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

What does type stripping do—and what does it not do?

Type annotations and other erasable syntax are removed at execution time. Node replaces annotations with whitespace so source locations are preserved; it does not generate source maps for this operation. Crucially, removing types is not the same as checking them. Node can run code with type errors if the remaining JavaScript is valid.

The TypeScript Handbook describes TypeScript as “a static typechecker for JavaScript programs”—a tool that runs before the program, checking whether its types are correct. That is a separate job from Node’s runtime stripping. If static validation matters, run the TypeScript compiler separately, for example:

npx tsc --noEmit

That command checks according to the project’s TypeScript configuration; it does not change how Node executes the file.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Which TypeScript syntax works without a transform?

The dividing line is whether TypeScript syntax can be erased without generating runtime code. Type annotations and type-only declarations generally fit. Syntax that needs TypeScript to generate JavaScript does not. The TypeScript 5.8 release notes discuss this boundary through the erasableSyntaxOnly option.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Syntax or feature With Node’s stripping-only execution
Type annotations and type-only declarations Stripped; no type checking is performed.
Enums Not supported by stripping alone because they require runtime code generation.
Namespaces with runtime code Not supported by stripping alone.
Parameter properties Not supported by stripping alone; they require generated assignments.
Import aliases such as TypeScript’s import = and export = Not supported by stripping alone.
Decorators Node does not transform them; they produce parser errors under the documented behavior.

These restrictions are not fixed by adding a type-stripping flag in current Node.js: Node.js v26 removed --experimental-transform-types. If your code depends on syntax that needs transformation, use a TypeScript-aware runner or build step rather than expecting stripping to compile it.

How do imports, modules, and aliases work?

Node executes TypeScript using the corresponding JavaScript module rules; it does not convert CommonJS into ES modules or vice versa. Use module syntax and package conventions that match the way Node should interpret the file, and make relative imports resolvable at runtime. For TypeScript files, write the relevant extensions explicitly, for example:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
import { helper } from './helper.ts';

For imports used only as types, mark them as type-only so Node does not try to load them as runtime values:

import type { RecordShape } from './types.ts';

You can also mark individual import specifiers with type. Without that modifier, Node treats an import as a runtime value import, which can fail if the imported value does not exist. TypeScript’s verbatimModuleSyntax option aligns the checker’s handling with this distinction.

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

Node does not read tsconfig.json. It will not rewrite paths aliases or downlevel newer JavaScript syntax to an older target. For some runtime aliasing needs, package subpath imports are an option, but Node’s documented form requires those specifiers to start with #.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

How should you configure TypeScript for this workflow?

Node’s current documentation recommends TypeScript 5.8 or newer and lists these settings as suitable for a project that runs TypeScript directly:

  • target: "esnext"
  • module: "nodenext"
  • rewriteRelativeImportExtensions: true
  • erasableSyntaxOnly: true
  • verbatimModuleSyntax: true

These are options for TypeScript tooling, such as the checker; Node itself does not load them. noEmit is optional if the project only executes .ts files directly. It is not appropriate as a blanket requirement when you need to produce distributable .js output.

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

When should you use built-in stripping or a runner such as tsx?

Choose based on the code you have and the work you expect the runtime workflow to do:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Approach Syntax coverage Configuration behavior Workflow fit
Node.js built-in stripping Erasable TypeScript syntax; no transforms for enums, runtime namespaces, parameter properties, import aliases, or decorators. Node ignores tsconfig.json, including paths rewriting. Runs supported .ts files directly; use a separate checker or build if needed.
Third-party TypeScript runner such as tsx Node’s documentation presents it as an option for full TypeScript transform support. Use when you need TypeScript configuration behavior; consult the runner’s documentation for its exact compatibility. Adds a runtime tool to the project. Node’s docs show installation as a development dependency and invocation with npx tsx or node --import=tsx.

To try the documented tsx route, install it as a development dependency, then run either:

npx tsx your-file.ts

Or load it through Node:

node --import=tsx your-file.ts

tsx is one option, not the only TypeScript runner. Select a tool against the syntax and configuration features your project actually uses; no speed comparison is established by the cited documentation.

What limitations should you check before running a .ts file?

  • Node refuses to handle TypeScript files within node_modules.
  • Type stripping does not make code compatible with older JavaScript targets; Node does not downlevel syntax.
  • Runtime imports must point to actual modules using Node’s module-resolution rules; TypeScript-only aliases are not rewritten.
  • Type annotations can disappear even when their declared types are wrong, so retain a checker if correctness depends on static analysis.

For the complete, version-specific behavior, consult the Node.js TypeScript documentation. For the erasable-syntax distinction, see the TypeScript 5.8 release notes. Node’s historical change to default enablement is described in the Node.js v23.6.0 release announcement.

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.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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