API Reference
tsx
Node.js enhancement to run TypeScript and ESM files directly, with a fast esbuild-based transform.
Official Documentation ↗CompatibilityThis documentation covers version
v4. Check the official docs for the latest API surface.Installation
npm
npm install --save-dev tsxMethods
No methods match this filter.
tsx registers an ESM loader and transform hook so Node runs .ts files without a separate build step.
Key Features
- Runs .ts, .tsx, .mts, and .cts directly
- Watch mode for local development
- Works as a Node –import loader in scripts
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
API reference evidence
Fetched from official sources on 2026-11-08T20:08:00+08:00 via WebFetch https://tsx.is/getting-started(返回 Loading…);WebFetch https://cdn.jsdelivr.net/npm/tsx@latest/README.md;WebFetch https://tsx.hirok.io/getting-started.
tsx (CLI)→ signature from https://tsx.hirok.io/getting-started; official text: “Run it from the same directory: shnpx tsx ./script.ts”
FAQ
- Is tsx a type checker?
- No. It strips types with esbuild and does not verify them. Run tsc --noEmit separately for type checking.
- How does tsx differ from ts-node?
- tsx transforms with esbuild and targets modern ESM, so it starts faster and needs less configuration; ts-node relies on the TypeScript compiler.
- Does tsx respect tsconfig paths?
- Yes. It reads paths and baseUrl from tsconfig and resolves them at runtime, matching the compiler configuration.
Report a problem with this API docOpens a pre-filled issue on GitHub.