TS-NODE(1)

πŸ’– TS-NODE(1) πŸ’–

okay bestie, welcome to the ts-node-script page from the User Commands corner of the ts-node manual. grab a boba, we're doing this πŸ’…


✨ NAME ✨

ts-node-script β€” run JavaScript and TypeScript code, like, right now, no build step, no drama πŸ¦‹


🌸 SYNOPSIS 🌸

ts-node-script [options] [-e script] [arguments]

πŸ’œ DESCRIPTION πŸ’œ

So the vibe is: this runs whatever script you hand it β€” either a file or code you inline with the -e switch β€” and it runs it through Node.js or TypeScript. that's it, that's the whole job, and it eats every time πŸ”₯

lowkey important: it is equivalent to running ts-node with the --script-mode switch. same energy, different entrance. no cap.

πŸŽ€ OPTIONS πŸŽ€

  • -e, --eval [code] β€” evaluate code, right there on the spot, no file needed ✨
  • -p, --print β€” print out the result of --eval (she said show me the receipts πŸ’…)
  • -r, --require [path] β€” require a node module before execution, so it's already loaded and ready 🫢
  • -i, --interactive β€” opens the REPL even if stdin does not appear to be a terminal. yes, even then. she does not care 😌
  • -h, --help β€” print CLI usage, aka the little map πŸ—ΊοΈ
  • -v, --version β€” print module version information πŸ‘‘
  • -s, --script-mode β€” use cwd from <script.ts> instead of current directory. the script's own home is the main character now 🏠
  • -T, --transpile-only β€” use TypeScript's faster transpileModule. speed, but make it chaotic πŸ’€
  • -H, --compiler-host β€” use TypeScript's compiler host API 🧚
  • -I, --ignore [pattern] β€” override the path patterns to skip compilation. tell her what to walk past πŸ™ˆ
  • -P, --project [path] β€” path to TypeScript JSON project file πŸ“
  • -C, --compiler [name] β€” specify a custom TypeScript compiler, bring your own πŸ”₯
  • -D, --ignore-diagnostics [code] β€” ignore TypeScript warnings by diagnostic code. selective hearing, but for the compiler 🎧
  • -O, --compiler-options [opts] β€” JSON object to merge with compiler options 🧩
  • --dir β€” specify working directory for config resolution πŸ“
  • --scope β€” scope compiler to files within cwd only. stay in your lane (affectionate) 🚧
  • --files β€” load files, include and exclude from tsconfig.json on startup πŸ“œ
  • --pretty β€” use pretty diagnostic formatter (usually enabled by default). she's already gorgeous but ok πŸ’–
  • --skip-project β€” skip reading tsconfig.json πŸ™…
  • --skip-ignore β€” skip --ignore checks πŸƒ
  • --prefer-ts-exts β€” prefer importing TypeScript files over JavaScript files. TypeScript girlies stay winning 🌈
  • --log-error β€” logs TypeScript errors to stderr instead of throwing exceptions πŸ“

bestie note: every single one of those flags is listed exactly as it exists. don't freestyle the spelling, the compiler will absolutely notice and it will be embarrassing 😭

okay that's the whole page, love u, go run something iconic ✨

this was ts-node v9.0.0, from November 2020 β€” the manual page was TS-NODE(1), and yes she's still serving πŸ’…πŸ‘‘πŸ¦‹