ts-node
ts-node is a TypeScript execution engine and REPL for Node.js that transforms TypeScript to JavaScript on the fly, enabling you to run .ts files directly withou…
Installation
npm install -D ts-node typescript
yarn add -D ts-node typescript
pnpm add -D ts-node typescript
Import
// Used as CLI: ts-node script.ts
Quick Example
// Run TypeScript directly: // npx ts-node src/script.ts // Fast mode (skip type checking): // npx ts-node --transpileOnly src/script.ts // REPL: // npx ts-node
About ts-node
ts-node is a TypeScript execution engine and REPL for Node.js that transforms TypeScript to JavaScript on the fly, enabling you to run .ts files directly without a separate compilation step. ts-node uses the TypeScript compiler API to perform both type checking and transpilation by default, though it can be configured to skip type checking for faster execution using the --transpileOnly flag or by using the faster @swc/register and @swc/core integration. The tool provides a TypeScript REPL for interactive experimentation, supports ESM modules through the --esm flag, handles path mapping from tsconfig.json, and integrates with Node.js's module loading system. ts-node can be used as a Node.js require hook (node -r ts-node/register), as a standalone CLI (ts-node script.ts), or programmatically for embedding TypeScript execution in other tools. ts-node is widely used for running development scripts, database migrations, and seed files. While tsx has gained popularity as a faster alternative, ts-node remains relevant for projects that need type checking during execution or require compatibility with the full TypeScript compiler feature set including project references.
Quick Facts
| Package | ts-node |
| Category | Build Tool |
| Weekly Downloads | 10M+ |
| License | MIT |
| Install | npm install -D ts-node typescript |
Related Packages
tsx is a TypeScript execute tool that lets you run TypeScript files directly in Node.js without a co…
TypeScript is a strongly typed programming language that builds on JavaScript, adding static type de…
esbuild is an extremely fast JavaScript and TypeScript bundler and minifier written in Go that is 10…
SWC (Speedy Web Compiler) is a Rust-based JavaScript/TypeScript compiler that provides a drop-in rep…
Babel is the standard JavaScript compiler that transforms modern JavaScript and TypeScript syntax in…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.