tsx vs ts-node
tsx vs ts-node compared for 2026: tsx 4.23.15 (esbuild-based TypeScript runner, no type checking, ESM and CommonJS out of the box, watch mode, MIT) vs ts-node 10.9.2 (TypeScript-compiler-based runner with type checking, last released December 2023, MIT), plus Node.js 26's built-in type stripping. Includes startup, memory, ESM, enum, decorator, path-alias and TypeScript 6/7 compatibility results from runs we did on the same machine, and a clear pick.
Quick Answer
For running TypeScript files in Node.js in late 2026, tsx is the default and ts-node is a legacy choice. ts-node's last release, 10.9.2, is from 8 December 2023 and its repository has had no push since July 2024. That now has consequences: with TypeScript 7.0.2, the Go-based compiler released in July 2026, ts-node crashed on startup in our run because the typescript package no longer exposes the JavaScript compiler API it calls. With TypeScript 6.0.3 it still works, but only once you write a tsconfig.json that avoids options TypeScript 6 deprecates; with no tsconfig at all, ts-node exited 0 without running our script. On Node.js 26.13.1, tsx ran a hello-world in 0.17 s and a 200-module project in 0.31 s, against 1.51 s and 1.90 s for ts-node with type checking; it ran native ESM with top-level await where ts-node needed the deprecated --loader flag. ts-node still does two things tsx cannot: it type-checks as it runs, and it emits decorator metadata, which NestJS-style dependency injection and TypeORM rely on. Node 26 can now run plain .ts files itself, but rejects enums, parameter properties and path aliases. Pick tsx plus a separate tsc --noEmit step for almost everything; keep ts-node only for an existing project that depends on emitDecoratorMetadata, pinned to TypeScript 6.
Last updated November 23, 2026. Covers tsx 4.23.15 (20 September 2026) and ts-node 10.9.2 (8 December 2023) with TypeScript 6.0.3 and 7.0.2 on Node.js 26.13.1 LTS; docs, release data and package metadata read on 23 November 2026, plus same-machine runs we did that day.
| Feature | tsx | ts-node |
|---|---|---|
| Licence & Repository | MIT; privatenumber/tsx, ~12.2k stars, last push 25 Sep 2026 | MIT; TypeStrong/ts-node, ~13.1k stars, 230 open issues, last push 18 Jul 2024 |
| Latest Release (Nov 2026) | 4.23.15 on 20 Sep 2026; frequent patch releases (eight between 5 Aug and 20 Sep 2026) | 10.9.2 on 8 Dec 2023; 10.9.1 on 14 Jul 2022 |
| Install Footprint | esbuild (~0.28.0) only; 12 MB, 3 packages on Linux x64 | Peer: typescript >=2.7 (plus optional @swc/core or @swc/wasm); 30 MB, 15 packages with TypeScript 6.0.3 and @types/node |
| How It Compiles | esbuild transform per file, cached on disk (first run 0.79 s, then 0.27-0.33 s for our 200 modules) | TypeScript language service by default; transpileModule with -T; SWC with --swc |
| Type Checking | None; run tsc --noEmit separately | Yes by default; off with -T or --swc |
| TypeScript 7 Compatibility | Unaffected: does not load the typescript package | No: crashed on startup with typescript 7.0.2 in our run |
| Native ESM | Yes, no flags; also node --import tsx | Via node --loader ts-node/esm (ExperimentalWarning); ts-node --esm and ts-node-esm failed on Node 26 in our run |
| CommonJS & require() | Yes; can require() ESM on supported Node versions | Yes: ts-node file.ts or node -r ts-node/register |
| tsconfig.json Handling | Optional; reads supported options (paths, jsx settings) from ./tsconfig.json or --tsconfig | Required in practice with TypeScript 6; reads it fully, with a ts-node section for its own options |
| tsconfig paths Aliases | Supported out of the box | Not resolved: Cannot find module '@lib/ver' until we added -r tsconfig-paths/register |
| Decorators & emitDecoratorMetadata | Decorators transform via esbuild; emitDecoratorMetadata not supported | Yes, including emitDecoratorMetadata (also in --swc mode) |
| Enums, Namespaces, Parameter Properties | Supported | Supported |
| Watch Mode | tsx watch, with --include/--exclude and Return to rerun | None built in (third-party wrappers such as nodemon) |
| REPL | Yes, TypeScript REPL | Yes, TypeScript REPL with type information |
| Versus Node.js 26 Built-in Type Stripping | Runs everything Node 26 strips plus enums, namespaces, parameter properties, paths and JSX | Runs everything Node 26 strips plus enums, namespaces, parameter properties and decorator metadata; adds type checking |
| Our Run: hello.ts startup (median of 8) | 0.17 s (0.15-0.20); node --import tsx 0.09 s | 1.51 s type-checked; 0.22 s with -T; 0.24 s with --swc |
| Our Run: 200-module project startup | 0.31 s median warm, 0.79 s first run with empty cache | 1.84-1.90 s type-checked; 0.81 s with -T; 0.37 s with --swc |
| Our Run: peak memory (RSS) | 62 MB (hello), 78 MB (200 modules) | 276 MB (hello) and 299 MB (200 modules) type-checked; 118 MB -T; 143-148 MB --swc |
| Our Run: "type": "module" project | Ran ./util.js import of util.ts with top-level await: exit 0 | ts-node, --esm, ts-node-esm: ERR_MODULE_NOT_FOUND; node --loader ts-node/esm: worked with ExperimentalWarning |
| Our Run: TypeScript 6.0.3 without and with tsconfig | Not applicable: same result with or without tsconfig | No tsconfig: exit 0, script never ran; -T: TS5107 deprecation error. With module nodenext, target es2022 and rootDir: worked |
tsx
tsx (TypeScript Execute) is a Node.js enhancement that runs TypeScript and modern JavaScript by transforming files with esbuild as Node loads them. You use it like the node binary: tsx file.ts, with any Node flag passed through, or node --import tsx file.ts. It does not type-check, works without a tsconfig.json, handles ESM and CommonJS in the same project, resolves tsconfig paths, and ships a watch mode and a TypeScript REPL. tsx is MIT-licensed, has ~12.2k GitHub stars and depends only on esbuild; 4.23.15 was released on 20 September 2026 and requires Node.js 18 or newer.
Pros
- Fast startup: 0.17 s median for hello.ts and 0.31 s for a 200-module project in our run, versus 1.51 s and 1.90 s for ts-node with type checking
- Native ESM with top-level await worked with no flags; so did node --import tsx (0.09 s for hello.ts)
- No dependency on the typescript package, so TypeScript 7's removal of the JavaScript compiler API does not affect it
- tsconfig paths aliases, JSX settings and enums work without plugins; a missing tsconfig.json is fine
- Small install: 12 MB and 3 packages on Linux, against 30 MB and 15 packages for ts-node with TypeScript 6
- Built-in watch mode (tsx watch) with include and exclude globs, and a TypeScript REPL
Cons
- No type checking: a file assigning a string to a number ran and printed the string; you need tsc --noEmit in CI or a pre-commit hook
- esbuild does not support emitDecoratorMetadata: Reflect.getMetadata('design:paramtypes') returned undefined in our run
- Only some tsconfig.json options are honoured, and eval() compatibility is not preserved, per its docs
- Its own docs note that esbuild has not reached a 1.0 release, which matters if you run tsx in production
Best For
Scripts, CLIs, dev servers, seed and migration scripts, test runners and monorepo tooling in ESM or mixed ESM/CommonJS projects, paired with a separate tsc --noEmit type check.
ts-node
ts-node is a TypeScript execution engine and REPL for Node.js from the TypeStrong organisation. By default it compiles each file with the installed TypeScript compiler's language service and type-checks as it goes; --transpileOnly (-T) skips type checking and --swc swaps in the SWC transpiler. It hooks into CommonJS require() and offers an ESM loader (ts-node/esm). ts-node is MIT-licensed with ~13.1k GitHub stars. The latest release, 10.9.2, is from 8 December 2023, the repository's last push was on 18 July 2024, and it requires typescript (>=2.7) as a peer dependency.
Pros
- Type-checks while running: our deliberate type error stopped execution with TS2322 and exit code 1
- Uses the real TypeScript compiler, so emitDecoratorMetadata works: we got design:paramtypes ['Db', 'Number'], which NestJS-style DI needs
- --swc mode is close to tsx for speed: 0.24 s for hello.ts and 0.37 s for 200 modules, still with decorator metadata
- Mature, widely documented CommonJS integration (node -r ts-node/register, mocha and older test setups)
- Honours your tsconfig.json fully, including compiler options esbuild ignores
Cons
- Unmaintained in practice: no release since December 2023 and no repository push since July 2024
- Crashes with TypeScript 7.0.2 (TypeError reading ts.sys) because the typescript package no longer exposes the JavaScript compiler API
- With TypeScript 6.0.3 and no tsconfig.json it exited 0 without running our script; TS 6 deprecations (node10 resolution, ES5 target, baseUrl) also broke -T until we wrote a tsconfig
- Slow and heavy with type checking: 1.51 s and 276 MB for hello.ts, 1.90 s and 299 MB for 200 modules
- ESM on Node 26 only worked through node --loader ts-node/esm, which prints an ExperimentalWarning; ts-node --esm failed with ERR_MODULE_NOT_FOUND
Best For
Existing CommonJS projects that rely on emitDecoratorMetadata (NestJS-style DI, TypeORM, class-validator setups) or on type-checking at run time, pinned to TypeScript 6 while a migration is planned.
Why this comparison changed in 2026
For years the choice was speed versus safety: tsx (esbuild, no type checking) started fast, ts-node (the TypeScript compiler) checked types as it ran. Three 2026 events turned it into a maintenance question. First, ts-node stopped moving. Its latest release is 10.9.2 from 8 December 2023, and the GitHub API showed the repository's last push on 18 July 2024, with 230 open issues. Second, TypeScript 7.0, the Go port of the compiler, shipped as typescript 7.0.2 on 8 July 2026. Its npm package's main export is now a small version module, with the new API under unstable/* subpaths; the classic JavaScript compiler API that ts-node calls is no longer exported. We installed [email protected] next to ts-node 10.9.2 and ts-node crashed before running anything: TypeError: Cannot read properties of undefined (reading 'fileExists') in its configuration loader. Third, Node.js made type stripping stable (v25.2.0 and v24.12.0) and Node 26 removed the --experimental-transform-types flag, so Node itself now runs simple .ts files but refuses syntax that needs transformation. tsx, which released eight patch versions between August and September 2026 and does not import the typescript package, was unaffected by all three. The result: tsx is the default runner, Node's built-in support covers simple scripts, and ts-node is a compatibility tool.
What we measured on Node.js 26
On 23 November 2026 we ran tsx 4.23.15 (esbuild 0.28.2) and ts-node 10.9.2 with TypeScript 6.0.3 and @swc/core 1.16.22 on Node.js 26.13.1 LTS (checksum-verified official build) in a 2-vCPU sandbox. Each command ran nine times; we report the median of the last eight. For a one-line hello.ts, plain node took 0.08 s, node --import tsx 0.09 s, the tsx CLI 0.17 s (it starts a child Node process), ts-node -T 0.22 s, ts-node --swc 0.24 s and type-checked ts-node 1.51 s. Peak memory followed the same order: 62 MB for tsx, 118 MB for -T, 143 MB for --swc and 276 MB for type-checked ts-node. We then generated a 200-module project, each module importing the next. tsx took 0.79 s on its first run, consistent with filling its on-disk transform cache, and 0.27-0.33 s afterwards with 78 MB. ts-node needed 1.84-1.90 s and 299 MB with type checking, 0.81 s with -T (transpileModule per file) and 0.37 s with --swc. Type checking separately is cheaper than it used to be: tsc --noEmit on the same project took 1.56 s with TypeScript 6.0.3 and 0.54 s with TypeScript 7.0.2. So tsx for running plus a TypeScript 7 check in CI is faster than ts-node checking on every start. These are small synthetic projects, not a benchmark of real applications.
ESM, path aliases and the TypeScript 6 trap
We set up a project with "type": "module", a main.ts that imports ./util.js (the TypeScript convention for util.ts under nodenext) and uses top-level await. tsx and node --import tsx ran it. ts-node main.ts, ts-node --esm main.ts and ts-node-esm main.ts all failed with ERR_MODULE_NOT_FOUND for util.js, the same error plain node gave, and the --esm variants also printed a DEP0180 fs.Stats deprecation warning from Node 26. Only node --loader ts-node/esm worked, with Node's ExperimentalWarning that --experimental-loader may be removed. ts-node's own README calls its ESM support not recommended for production because it depends on loader hooks Node can change. Path aliases split the same way: with paths mapping @lib/* to ./lib/*, tsx resolved the import, ts-node threw Cannot find module '@lib/ver' until we added -r tsconfig-paths/register, and Node refused it. The bigger surprise came from TypeScript 6.0.3 itself, which turns several old defaults into errors. With no tsconfig.json, ts-node exited 0 and silently skipped our script, which wrote nothing and printed nothing; ts-node -T failed with TS5107 because its implied moduleResolution node10 is deprecated. A tsconfig with module nodenext still failed under -T on the implied ES5 target, then on baseUrl (TS5101), and our 200-module project needed an explicit rootDir (TS5011). tsx behaved the same with or without a tsconfig.
Where ts-node still wins: decorators and type-aware runs
tsx's limits come from esbuild, and its docs are explicit about them: only some tsconfig.json options are read, eval() compatibility is not preserved, and emitDecoratorMetadata is not supported. That last one is the reason some teams cannot switch. We ran a class with an @Injectable() decorator and a constructor taking a Db and a number, then read Reflect.getMetadata('design:paramtypes'). Under ts-node, both type-checked and with --swc, it returned ['Db', 'Number']; under tsx it returned undefined. Frameworks that resolve constructor dependencies from that metadata, such as NestJS's dependency injection or TypeORM's column type inference, therefore break silently under tsx, failing at run time rather than at startup. Under Node's own type stripping the same file did not even parse, because parameter properties need transformation: ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX. The other ts-node advantage is philosophical: it refuses to run code that does not type-check. Our file assigning a string to a number stopped with TS2322 under ts-node and ran happily under tsx and node. Most teams now prefer editor checking plus tsc in CI and pre-commit, as tsx's docs recommend, but if you rely on 'it won't start if types are wrong' in a script runner, that guarantee disappears when you switch, and you must add the check back explicitly.
Node 26 built-in TypeScript: when you need neither
Node.js 26 runs .ts files directly by replacing type annotations with whitespace, so no source maps are needed and stack traces keep their line numbers. It is fast, 0.08 s for our hello.ts and about 66 MB, and has no dependencies. The limits are documented and we hit each one. It does not read tsconfig.json, so paths aliases fail. Syntax that must be rewritten to JavaScript is rejected: our enum file failed with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX 'TypeScript enum is not supported in strip-only mode', and parameter properties, namespaces with runtime code and import aliases fail the same way; Node 26 removed the --experimental-transform-types flag that used to cover them. Type-only imports must use the type keyword, which verbatimModuleSyntax enforces, and imports must include the .ts extension, which allowImportingTsExtensions lets tsc accept. Node also refuses to strip types inside node_modules, to discourage publishing raw TypeScript. Node's own docs point to tsx when you need full TypeScript support. A practical split: use node file.ts for small scripts written in erasable-syntax TypeScript (enable erasableSyntaxOnly in tsconfig to keep it that way), use tsx for applications, tests and tooling that use enums, aliases, JSX or CommonJS interop, and reserve ts-node for decorator-metadata projects until they move to a build step.
Verdict
Use tsx. It ran every pattern we tried except decorator metadata, it was 5-9x faster to start than type-checked ts-node with a quarter of the memory, it handled ESM without flags, and it is maintained and independent of the typescript package, which matters now that TypeScript 7 has dropped the JavaScript compiler API that ts-node depends on. Pair it with a type check: tsc --noEmit from TypeScript 7 checked our 200-module project in 0.54 s, against 1.56 s for TypeScript 6, so 'tsx to run, tsc to check' costs less than ts-node's run-time checking. Keep ts-node only where you need emitDecoratorMetadata (NestJS dependency injection, TypeORM entities) or a CommonJS setup you cannot touch yet; pin typescript to 6.x, write an explicit tsconfig.json, prefer --swc for speed, and plan to move such projects to building with tsc or SWC and running the output with node. For new projects with simple TypeScript and no enums or aliases, Node 26's built-in type stripping is enough for scripts: node file.ts started in 0.08 s in our run. Do not start a new project on ts-node.