1. License
“Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction”
Any use is allowed; keep the MIT notice with tsx's files.
github.com/privatenumber/tsx/blob/master/LICENSE3. Used by agents' projects
Dependency in 953 public GitHub projects set up for AI coding agents that we scanned (15.2%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error
What tsx does
tsx is a free command that runs TypeScript files directly with Node.js, the same way node runs JavaScript. Your assistant can write a script, a small server or a test in TypeScript and run it at once, with no separate build step. It does not check types; that stays a separate step.
What people build with it
Run a one-off TypeScript script
Your assistant writes a script that fills a test database or exports orders to a spreadsheet, and runs it at once with one command.
Restart the app on every save
While you work on a small server or bot, it reruns by itself each time a file changes.
Test TypeScript with Node's runner
Tests written in TypeScript run with Node.js's own test runner, with no extra test framework.
TypeScript config files in your tool
People who use your tool or plugin system write its settings file in TypeScript, and your tool loads it.
A small backend without a build
A small internal app runs from its TypeScript files on the server, if tsx is installed there as a normal package.
Run a local helper for your AI assistant Idea
A small TypeScript helper, such as a local tool server your assistant connects to, starts with one tsx command.
tsx popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How tsx is used
- tsx is a dependency in 953 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (19.6% of the 4,867 JavaScript/TypeScript ones), #2 of 70 in languages, types and runtimes.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,231; those are left out of every share on this page.
- The most used alternative in our scan is ts-node (295 projects).
- Projects that use it most often also use TypeScript (95.3%), Zod (58.2%), dotenv (44.8%).
- It is more common in projects set up for OpenClaw (23.4%) than for OpenCode (13.1%).
By coding agent
Often used with
tsx in practice
Strengths
You call tsx the way you call <code>node</code>, and Node CLI flags pass through. The site's example is <code>tsx --env-file=.env ./file.js</code>, which also shows that plain JS files run.
The site says you can run TypeScript "without worrying about configuration" because tsx ships with "modern and sensible defaults".
The site says CommonJS code can load ESM dependencies without <code>ERR_REQUIRE_ESM</code> "on supported Node.js versions".
tsx reads <code>tsconfig.json</code> paths. Its Watch mode re-runs your files each time you save them.
Watch out for
The ESM help covers CommonJS loading ESM. The site says Node.js module semantics still apply when an ES module imports CommonJS. For legacy packages with incompatible default exports, it points to the FAQ.
Mehul Kar's post is inconsistent about Node 18. One passage says <code>--loader</code> does not work there but <code>--import</code> does. Another says <code>--import tsx</code> doesn't work in Node 18 and that he just bumped to Node 20. His working setup is pinned to Node v20.11.1 and tsx@4.7.2, and he notes that versions matter more in nascent technology.
Install as a dev dependency and run a file
$ npm install -D tsx
$ npx tsx ./file.tsMore about tsx
Funding
- GitHub Sponsors: https://github.com/privatenumber
- 34 GitHub sponsors
Head to head
- tsx vs ts-node used together in 89 projects
- tsx vs jiti used together in 64 projects
Packages around it
- typescript: The language tsx runs
- zod: Schema validation
- vitest: Test runner
- dotenv: Env file loading
- @modelcontextprotocol: MCP SDK
- express: Web server framework
More in Languages, types and runtimes
Alternatives
tsx This page
Pick ts-node when you want types checked while the code runs, using the TypeScript compiler itself.
Pick jiti when a tool only needs to load TypeScript config files at runtime with no command of its own.
Pick Bun when you are ready to switch the whole runtime; it runs TypeScript itself and also installs packages.
Get started
Tell your AI assistant
“Add tsx as a dev dependency (pin tsx@4.23.15, Node.js 20.6+), run TypeScript scripts with npx tsx ./file.ts (tsx flags before the file, script arguments after), use tsx watch during development, and add a separate "type-check" script with tsc --noEmit.”
Install tsx in your project as a development package.
npm install -D tsx
Rules for your agent
## tsx
- Run TypeScript files with `tsx file.ts` wherever you would use `node file.js`. Node CLI flags such as `--env-file=.env` pass through.
- Install it as a project dev dependency (`npm install -D tsx`, `pnpm add -D tsx` or `yarn add -D tsx`).
- Inside `package.json#scripts`, call `tsx` directly without `npx`, for example `"start": "tsx ./file.ts"`.
- For a one-off run without installing, use `npx tsx ./script.ts`.
- Use a maintained Node.js version. The docs say tsx targets all maintained versions, and loading ESM from CommonJS works only "on supported Node.js versions".
- When an ES module imports a CommonJS package, Node.js module semantics still apply. Check the tsx FAQ before working around legacy packages with incompatible default exports.
- Don't run `yarn global add` with Yarn 2. The docs note that Yarn 2 doesn't support global installation.
Mistakes to avoid
tsx strips types without checking them; in our run const seats: number = 'three' ran and printed three.
Node's built-in type stripping errors on enums; in our run Node.js 24.22.2 failed with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX: TypeScript enum is not supported in strip-only mode.
Everything after the file path goes to your script, not to tsx or Node.js.
Top-level await needs ES module mode, and the import syntax alone does not choose it.
Production installs that skip development packages will not have tsx.
Questions
Does it check my types?
No. Run tsc --noEmit separately; in our run a file assigning a word to a number still ran.
Node.js can run .ts files now. Do I still need tsx?
Node.js only strips types; enums, namespaces with code and tsconfig paths fail there. In our run Node.js 24 stopped at an enum that tsx ran.
Can I use it in production?
Yes, if tsx is installed as a normal package there; the other option is to build JavaScript first and run that.
How is it different from ts-node?
tsx uses esbuild and needs no TypeScript compiler to run code; ts-node uses the compiler and can check types while it runs.
Can I use it in a paid product?
Yes. tsx is under the MIT license.