Navigate:
ts-node
~$TSNOD0.0%

ts-node: TypeScript execution for Node.js

Execute TypeScript directly without precompilation step.

LIVE RANKINGS • 12:26 PM • STEADY
OVERALL
#429
9
DEVELOPER TOOLS
#92
7
30 DAY RANKING TREND
ovr#429
·Devel#92
STARS
13.1K
FORKS
546
7D STARS
+2
7D FORKS
0
See Repo:
Share:

Learn more about ts-node

ts-node is a TypeScript execution engine and REPL for Node.js that enables direct execution of TypeScript files without an explicit compilation step. It works by registering itself as a module loader that intercepts TypeScript file imports, transpiles them to JavaScript in memory using the TypeScript compiler API, and then executes the resulting code through the Node.js runtime. The tool supports full TypeScript language features including type checking, interfaces, generics, and modern ECMAScript syntax while respecting tsconfig.json configuration options. It integrates seamlessly with Node.js environment variables, module resolution, and the standard library, making it suitable for development workflows, scripting, and testing scenarios. The just-in-time compilation approach trades some startup performance overhead for the convenience of eliminating build tooling from the development loop.

ts-node

1

Direct TypeScript execution

Runs TypeScript files directly without a build step by intercepting Node.js module loading and transpiling on demand. Supports both CommonJS and native ESM with configurable module resolution.

2

Configurable transpilation backends

Allows switching between the TypeScript compiler and SWC for transpilation, with options to skip type checking entirely for faster execution or enable full type checking as needed.

3

Interactive REPL with source maps

Provides a TypeScript-aware REPL for interactive development and includes source map support for debugging, allowing stack traces to reference original TypeScript source rather than transpiled output.


import { register } from 'ts-node';

// Register ts-node to handle .ts files
register({
  compilerOptions: {
    module: 'commonjs',
    target: 'es2020'
  }
});

// Now you can require TypeScript files directly
const myModule = require('./myScript.ts');
myModule.run();

vv10.9.2

Fixes tsconfig.json file not found issue on latest TypeScript version

  • Fixed tsconfig.json file not found on latest TypeScript version
vv10.9.1

Workarounds nodejs bug affecting node >=18.6.0 using --esm

  • Workaround nodejs bug introduced in 18.6.0
  • Only affects projects on node >=18.6.0 using --esm
  • Older versions of node and projects without --esm are unaffected
vv10.9.0

Enhances --project option and adds experimental TypeScript import specifiers support

  • --project accepts path to a directory containing a tsconfig.json (previously it required an explicit filename)
  • Added helpful error message when swc version is too old to support our configuration
  • Added experimentalTsImportSpecifiers option which allows using voluntary .ts file extensions in import specifiers
  • Fixed bug where child_process.fork() would erroneously execute the parent's entrypoint script, not the intended child script


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers