13,117
stars
+0+0+1
548
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions
README
TypeScript execution and REPL for node.js, with source map and native ESM support.
The latest documentation can also be found on our website:
Table of Contents
Overview
Features
Installation
Usage
Command Line
Shebang
node flags and other tools
Programmatic
Configuration
CLI flags
Via tsconfig.json (recommended)
@tsconfig/bases
Default config
node flags
Options
CLI Options
help
version
eval
print
interactive
esm
TSConfig Options
project
skipProject
cwdMode
compilerOptions
showConfig
Typechecking
transpileOnly
typeCheck
compilerHost
files
ignoreDiagnostics
Transpilation Options
ignore
skipIgnore
compiler
swc
transpiler
preferTsExts
Diagnostic Options
logError
pretty
TS_NODE_DEBUG
Advanced Options
require
cwd
emit
scope
scopeDir
moduleTypes
TS_NODE_HISTORY
noExperimentalReplAwait
experimentalResolver
experimentalSpecifierResolution
API Options
SWC
CommonJS vs native ECMAScript modules
CommonJS
Native ECMAScript modules
Troubleshooting
Configuration
Common errors
TSError
SyntaxError
Unsupported JavaScript syntax
ERR_REQUIRE_ESM
ERR_UNKNOWN_FILE_EXTENSION
Missing Types
npx, yarn dlx, and node_modules
Performance
Skip typechecking
With typechecking
Advanced
How it works
Ignored files
File extensions
Skipping node_modules
Skipping pre-compiled TypeScript
Scope by directory
Ignore by regexp
paths and baseUrl
Why is this not built-in to ts-node?
Third-party compilers
Transpilers
Third-party plugins
Write your own plugin
Module type overrides
Caveats
API
Recipes
Watching and restarting
AVA
CommonJS
Native ECMAScript modules
Gulp
IntelliJ and Webstorm
Mocha
Mocha 7 and newer
Mocha
Example
ts-node -e 'console.log("Hello world!")'
Evaluate code
print
shell
ts-node -p -e
Example
ts-node -p -e '"Hello world!"'
Print result of --eval
interactive
shell
ts-node -i
Opens the REPL even if stdin does not appear to be a terminal
esm
shell
ts-node --esm
ts-node-esm
Bootstrap with the ESM loader, enabling full ESM support
TSConfig Options
project
shell
ts-node -P
ts-node --project
Path to tsconfig file.
Note the uppercase -P. This is different from tsc's