tsx
ts-node
tsx | ts-node | |
---|---|---|
29 | 23 | |
9,649 | 12,907 | |
2.5% | 0.4% | |
9.4 | 2.9 | |
11 days ago | 4 months ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
tsx
-
NextJS + Drizzle -- 8 Things I Learned Spinning up a New Project
To test and iterate on backend code, I've started calling some modules (like OpenAI researches) from scripts I execute via the terminal. Copious console.debug and console.warn statements make this a kinda effective way to debug without having to craft a frontend. To execute these scripts, I use TSX resulting in commands like this one that extracts events from history books:
-
Setting up Subpath Import Aliases in a TypeScript Project
For other tools, you should check their documentation on custom conditions support. I've tried to run my project with tsx. As it supports all Node.js flags, I've just provided custom condition via -C flag:
- TypeScript Execute (TSX)
-
Effortless API Testing: Node.js Techniques for Next.js Route handlers
Luckily, this is a very common thing and Tsx, a can help us with this. We simply have to import this module and we'll be able to execute Typescript code with Node.js:
-
Using TypeScript in Node.js projects
Next, we need to set up a development script that will watch for changes in our TypeScript files and recompile them. Personally, I like to use tsx, as it provides a much faster development experience compared to the built-in TypeScript watcher or ts-node. First, install tsx:
-
Making Eleventy Data Traceable with TSX and Zod
At this point, you will have a setup which relies on tsx to understand TypeScript, and jsx-async-runtime to understand JSX/TSX templates.
-
Finally, a guide for Node.js and TypeScript and ESM that works
I really enjoy frontend/node/typescript development. I roll my eyes whenever the HN-types complain about CSS or frontend development being a hellhole. Mostly the comments I see seem ignorant or impatient ("Why doesn't this thing work without be bothering to learn it?")
However, the intersection of typescript, nodejs, and ES modules is consistently the most frustrating experience I ever have. Trying to figure out which magic incantation of tsconfig/esbuild/tsc/node options will let me just write code and run it is a fools errand. You might figure something out, and then you try to use Jest and then you descend into madness again.
The biggest tip I can give people is to ditch ts-node and just use (the awkwardly named) tsx https://github.com/privatenumber/tsx, which pretty much just "mostly works" for running Typescript during dev for node.
The problem mostly seems to stem for all the stakeholders being pretty dogmatic to whatever their goals are, rather than the pragmatic option of just meeting people where they are. I really wish the Node, Typescript, Deno/Bun, and maybe some bundler people would come together and figure out how to make this easier for people.
-
ERDIA: TypeORM entity specification documentation tool
If your TypeORM entity is written in TypeScript, you have to run ERDIA using ts-node or tsx as follows.
-
xtsz - a TS / JS file runner with support for HTTP/S imports
Want to import a package / file conveniently from esm.sh or unpkg or directly from a GitHub repo for a one-off script (for example). To do this I created a custom ESBuild plugin to handle HTTP imports - that worked for ,js files. To support running both ESM and CJS, I use tsx.
-
What is your must have npm package on any given project?
I prefer tsx honestly. Nodemon will detect that your using TypeScript and switch from node to ts-node but tsx is a no config necessary version of ts-node that also runs faster. Of course you can configure ts-node to use swc to be faster but then you're playing with config files to get things working.
ts-node
-
Stylelint plugin using Typescript
use ts-node
- FLaNK-AIM: 20 May 2024 Weekly
-
Setup a simple Node Typescript Project in 5 minutes - 2024 edition
tsx : for typescript code execution. It is a replacement of ts-node. As the latter does not work in Node 20
-
TypeScript Without Transpilation
I thought this was going to be a project like ts-node [1]
[1] https://github.com/TypeStrong/ts-node
- Is your language eco friendly?
-
Deploy a static site to AWS S3 and CloudFront using AWS CDK
The command specified in the app option uses ts-node by default, which is an execution engine for Node.js that allows you to run TypeScript code directly. The --prefer-ts-exts flag prevents ts-node from prioritizing precompiled .js files and will always import the TypeScript source code instead, if it is available. This is useful if you are also using tsc (the TypeScript compiler) alongside the app option. The bin/cdk.ts file is the entry point for our CDK app, which defines the main function that will be executed when the app is run.
- Use tsx instead of nodemon
-
Couple super basic Typescript questions from a newbie: how to compile and how to start learning
If you want to write apps that run on Node.js I would suggest using Google’s TypeScript style guide. You can start using it by simply running npx gts init. I’d suggest that you start with this and run your apps using ts-node/ts-node-dev because it does not require an extra build step.
-
Looking for a TS REPL/tinkering tool, any recommendations?
ts-node (“TypeScript execution and REPL for Node.js”)
-
"SyntaxError: Cannot use import statement outside a module" trying to run Mathigon/Studio
Here is a relevant discussion and dev comment: https://github.com/TypeStrong/ts-node/issues/155
What are some alternatives?
esbuild-runner - ⚡️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild
swc-node - Faster ts-node without typecheck
ts-runtime-comparison - Comparison of Node.js TypeScript runtimes
esbuild - An extremely fast bundler for the web
esno - Alias to `tsx`
esbuild-node-tsc - Build your Typescript Node.js projects using blazing fast esbuild
swc - Rust-based platform for the Web
tsc-esm-fix - Make Typescript projects compatible with esm/mjs requirements
sucrase - Super-fast alternative to Babel for when you can target modern JS runtimes
cnc4me - Monorepo for all the fun tools made for machinists and programmers
vike - 🔨 Flexible, lean, community-driven, dependable, fast Vite-based frontend framework.