Running TypeScript code with ts-node
ts-node is a TypeScript execution environment for Node.js. It allows you to run TypeScript code directly in Node.js without the need to compile it first. By default, ts-node performs type checking unless transpileOnly is enabled.
While
ts-node can catch type errors at runtime, we still recommend type-checking your code first with tsc before shipping it.Running TypeScript code with tsx
tsx is another TypeScript execution environment for Node.js. It allows you to run TypeScript code directly in Node.js without the need to compile it first.
Registering tsx via node
If you want to use tsx via node, you can register tsx via --import: