tsr-node
raw JSON → 0.1.1 verified Fri May 01 auth: no javascript
A minimal TypeScript runner for Node.js (version 0.1.1), built on esbuild for fast transpilation. Unlike ts-node which uses the TypeScript compiler (tsc), tsr leverages esbuild's speed for instant execution. Ideal for quick scripts and development, but lacks type-checking. Release cadence is unknown.
Common errors
error tsr: command not found ↓
cause Package not installed or not in PATH
fix
Run
npm i -g tsr-node. error Error: Cannot find module 'esbuild' ↓
cause Missing esbuild dependency (it's a peer dependency?)
fix
Install esbuild:
npm i -g esbuild or reinstall tsr-node. Warnings
gotcha No type-checking at runtime ↓
fix Run `tsc --noEmit` separately for type checks.
gotcha Uses esbuild, which may not support all TypeScript features like decorators or const enums ↓
fix Check esbuild's compatibility for your features.
gotcha Global install may conflict with other Node.js tools ↓
fix Use `npx tsr-node hello.ts` to avoid global installation.
Install
npm install tsr-node yarn add tsr-node pnpm add tsr-node Imports
- default wrong
const tsr = require('tsr-node')correctimport {} from 'tsr-node'
Quickstart
# install
npm i -g tsr-node
# create a file
echo 'const greet = (name: string) => `Hello, ${name}!`; console.log(greet("World"));' > hello.ts
# run
tsr hello.ts