tsx (TypeScript Execute) is a command-line interface (CLI) tool that enhances Node.js by providing a seamless way to run TypeScript and ESM files directly, leveraging esbuild for fast transpilation. It allows developers to execute TypeScript without a separate compilation step. The current stable version is 4.21.0. The project is actively maintained with frequent minor releases and bug fixes, often occurring every few weeks.
npm install tsxNo compatibility data collected yet for this library.
Demonstrates how to run a TypeScript file directly using the `tsx` CLI without prior compilation.
Upgrade your Node.js runtime to version 18.0.0 or newer using a version manager like nvm or volta.
Be aware that tsx manages TypeScript transpilation independently of Node.js's native --loader options.
Use a separate type checker (e.g., tsc --noEmit) in your development workflow or CI/CD pipeline for type validation.
Simplify tsconfig.json if possible, or verify specific compilerOptions behavior. Ensure baseUrl is correctly configured if using path aliases.
Upgrade Node.js to version 18.0.0 or newer using a version manager like nvm or volta.
Install tsx globally via `npm install -g tsx` or execute it using `npx tsx <your-script.ts>`.
Ensure your `baseUrl` and `paths` are correctly defined in `tsconfig.json`. tsx generally has good path alias support; verify project structure and import paths.
Convert `require` statements to `import` statements, or ensure the file is explicitly treated as CommonJS (e.g., by using a `.cjs` extension or setting `type: "commonjs"` in the nearest `package.json`).
No dependency data recorded yet.