ts-node: TypeScript execution for Node.js
Execute TypeScript directly without precompilation step.
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.
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.
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.
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();Fixes tsconfig.json file not found issue on latest TypeScript version
- –Fixed tsconfig.json file not found on latest TypeScript version
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
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
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
JSON for Modern C++
Header-only C++ library for JSON with STL-like containers.
ExcelJS
Parse, modify, and generate XLSX files in Node.js.
Hugo
Fast static site generator written in Go with built-in asset processing and multiple content formats.
Bun
Fast JavaScript runtime with built-in bundler and package manager.
StatsD
UDP/TCP metrics collector with pluggable backend support.
Related Reading
Guides and comparisons from the Greptile content library
Best CodeRabbit Alternatives for Smarter AI Code Reviews in 2026
7 powerful CodeRabbit alternatives ranked by real dev teams. Feature comparison, pricing analysis, and honest reviews to find your perfect AI code reviewer.
Greptile Ranks #1 on Martian's AI Code Review Benchmark
Greptile ranks #1 on Martian's independent online AI code review benchmark, leading all evaluated tools in F1 score and precision with near-leading recall.
Best Developer Productivity Tools in 2026
The best developer productivity tools in 2026, compared by the workflow problem they solve: code review, autocomplete, AI-native editing, terminal agents, code search, observability, and security.
How to ACTUALLY Think About Code Reviews: The 3-Layer Checklist
A code review checklist and best practices organized around three layers — Mechanical, Structural, and Narrative — that help any team improve code quality without slowing reviews down.