API Reference
ts-node
TypeScript execution engine and REPL for Node.js, compiling on the fly and supporting tsconfig paths.
Official Documentation ↗CompatibilityThis documentation covers version
v10. Check the official docs for the latest API surface.Installation
npm
npm install --save-dev ts-nodeMethods
No methods match this filter.
ts-node hooks into Node require and module resolution to compile TypeScript as it is loaded.
Key Features
- On-the-fly compilation via the TypeScript compiler
- tsconfig integration including paths
- Programmatic register API for embedding
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Errors
The official API reference declares the following error types:
TSError(错误类(官方 API 索引 Other 段的 classes 条目)) — official text: “- TSError” (source: https://typestrong.org/ts-node/api/index.html, fetched 2026-11-08T20:07:00+08:00)
API reference evidence
Fetched from official sources on 2026-11-08T20:07:00+08:00 via WebFetch https://typestrong.org/ts-node/docs/usage/;WebFetch https://typestrong.org/ts-node/api/index.html.
ts-node (CLI)→ signature from https://typestrong.org/ts-node/docs/usage/; official text: “# Execute a script asnode+tsc. ts-node script.ts”register→ signature from https://typestrong.org/ts-node/api/index.html; official text: “- register(opts?: RegisterOptions): Service - register(service: [Service](https://typest”ts-node/esm→ signature from https://typestrong.org/ts-node/docs/usage/; official text: “If you are invoking node directly, you can avoid the environment variable and pass those flags to node.shell node --loader ts-node/esm --inspect ./index.ts”
FAQ
- Why is ts-node slower than tsx?
- ts-node runs the full TypeScript compiler by default. Set transpileOnly: true or use the swc backend to skip type checking and start faster.
- How do I avoid compiling type-check output twice?
- Combine ts-node with tsc --noEmit in CI: ts-node runs tests, tsc verifies types once, so the compiler cost is paid a single time.
- Does it support ESM?
- Yes through the ts-node/esm loader, but it requires experimental flags on some Node versions and stricter module settings.
Report a problem with this API docOpens a pre-filled issue on GitHub.