Options
ts-node supports --print (-p), --eval (-e), --require (-r) and --interactive (-i) similar to the node.js CLI options.
The API includes additional options not shown below.
Environment variables, where available, are in ALL_CAPS
| CLI | TSConfig | Description |
|---|---|---|
| Shell | ||
-h, --help | Prints the help text | |
-v, --version | Prints the version. -vv prints node and typescript compiler versions, too | |
-e, --eval | Evaluate code | |
-p, --print | Print result of --eval | |
-i, --interactive | Opens the REPL even if stdin does not appear to be a terminal | |
| TSConfig | ||
-P, --project [path] | Path to TypeScript JSON project file Env: TS_NODE_PROJECT | |
--skip-project | Skip project config resolution and loading Default: false Env: TS_NODE_SKIP_PROJECT | |
-c, --cwd-mode | Resolve config relative to the current directory instead of the directory of the entrypoint script | |
-O, --compiler-options [opts] | compilerOptions | JSON object to merge with compiler options Env: TS_NODE_COMPILER_OPTIONS |
--show-config | Print resolved tsconfig.json, including ts-node options, and exit | |
| Typechecking | ||
-T, --transpile-only | transpileOnly | Use TypeScript's faster transpileModule Default: false Env: TS_NODE_TRANSPILE_ONLY |
--type-check | Opposite of --transpile-only Default: trueEnv: TS_NODE_TYPE_CHECK | |
-H, --compiler-host | compilerHost | Use TypeScript's compiler host API Default: false Env: TS_NODE_COMPILER_HOST |
--files | files | Load files, include and exclude from tsconfig.json on startup Default: false Env: TS_NODE_FILES |
-D, --ignore-diagnostics [code] | ignoreDiagnostics | Ignore TypeScript warnings by diagnostic code Env: TS_NODE_IGNORE_DIAGNOSTICS |
| Transpilation | ||
-I, --ignore [pattern] | ignore | Override the path patterns to skip compilation Default: /node_modules/ Env: TS_NODE_IGNORE |
--skip-ignore | skipIgnore | Skip ignore checks Default: false Env: TS_NODE_SKIP_IGNORE |
-C, --compiler [name] | compiler | Specify a custom TypeScript compiler Default: typescript Env: TS_NODE_COMPILER |
--transpiler [name] | transpiler | Specify a third-party, non-typechecking transpiler |
--prefer-ts-exts | preferTsExts | Re-order file extensions so that TypeScript imports are preferred Default: false Env: TS_NODE_PREFER_TS_EXTS |
| Diagnostics | ||
--log-error | logError | Logs TypeScript errors to stderr instead of throwing exceptions Default: false Env: TS_NODE_LOG_ERROR |
--pretty | pretty | Use pretty diagnostic formatter Default: false Env: TS_NODE_PRETTY |
| Enable debug logging Env: TS_NODE_DEBUG | ||
| Advanced | ||
-r, --require [path] | require | Require a node module before execution |
--cwd | Behave as if invoked in this working directory Default: process.cwd()Env: TS_NODE_CWD | |
--emit | emit | Emit output files into .ts-node directory Default: false Env: TS_NODE_EMIT |
| Path to history file for REPL Default: ~/.ts_node_repl_historyEnv: TS_NODE_HISTORY | ||