Whilst I use an esbuild based build pipeline to produce production artifacts, I've found that the combination of native type transformation and node:test improvements is now sufficient to do away with most test frameworks.
My nodejs projects have tests that run faster and have fewer breaking dependencies.
The two things I have to do are to always annotate type imports with type (I have a script for that), and to use file extensions on imports.
This is great to finally see get added. I wonder why they decided to build their own type stripper instead of just bundling tsc/swc. It feels like Node.js is going to be plagued with bugs whenever TypeScript adds new type constructs, which may take months to get patched.
Would it be possible for the maintainers of Typescript to provide an official stripper that could be deployed alongside new versions of Typescript, and then snapped in?
I don't mean this rhetorically, but what are the benefits of using node over something like deno now? It has been so long since I lived in the node ecosystem. I imagine it has gotten quite a bit better. Is the main benefit just ecosystem/compatibility stuff? Deno sometimes has some odd compatibility issues, but not often. The low-overhead, sane defaults, just-build kind of nature of it has become very appealing to me. Being able to build CLIs in portable binaries using a language my coworkers understand is really nice (despite that they're like 60mb, haha). I prefer Go personally, but ultimately prefer being able to collaborate.
It's funny, I would actually argue the opposite point. When Deno and Bun first came out, they promised a hard break from the Node ecosystem, like how Deno leaned heavily into browser compatibility, and Bun into framework features like Bun.App.
At some point they both decided that Node compatibility was more important than their unique features, but in the time since their release Node got type stripping, require(esm), sqlite, single executable apps, a permission system, a test runner, and basically ever other Deno/Bun feature they could port over.
So at this point why use runtimes that imitate Node when you could just use Node? You'll get most of the modern niceties, but also get 100% compatibility with the existing ecosystem.
It’s purely ecosystem at this point. Deno, Bun, any runtime is more modern. It’s nice they are catching up but by the time typescript is a native citizen in node, others may take the crown. The codebase is ooof.
That said, there’s something to be said about being the first mover and having the ecosystem so node isn’t going away anytime soon, nor is the npm/npx ecosystem.
Go has the ability to, with a goja fork [1], to execute ESM but you would still need to transpile using another go tool to run it. I have such a runtime but it’s nowhere near as fast as bun or deno. I use it mainly so I can have agents do my local bidding.
So if you use this, what do you use to enforce the types? Are you still running tsc --noEmit?
I'm embarking on a project where the various tsconfig files are getting quite unwieldy. I'd have already jumped to Deno but it just won't work right when the actual deployment is to Cloudflare Workers.
I honestly wish Microsoft and TypeScript enthusiasts would transform it into an official standalone language and stop polluting the JavaScript ecosystem.
Like C++, it could be a true superset of JS, importing JS code freely into TypeScript projects. It would also allow TypeScript to do whatever it wanted and not have to worry about transpilation. If it needs to work in the browser, it can be bundled into web assembly.
This is a mischaracterization of TypeScript. Unlike the relationship of C++ to C, TS is explicitly not a separate language from JS, and introduces no new capabilities. There’s no engine that executes TypeScript. It doesn’t do anything (*) that JavaScript doesn’t do. It just layers a type system onto JavaScript so you can tell when your JS code doesn’t make sense.
(*) with small exceptions like enums, which some think were a mistake for that reason
There is no pollution. Typescript is a strict super set. I always joke that Typescript is JavaScript code mixed with compiler instructions. The type annotations are not code.
Normal_gaussian|7 months ago
My nodejs projects have tests that run faster and have fewer breaking dependencies.
The two things I have to do are to always annotate type imports with type (I have a script for that), and to use file extensions on imports.
dimava|7 months ago
jadbox|7 months ago
Eric_WVGG|7 months ago
mosdl|7 months ago
eyelidlessness|7 months ago
steve_adams_86|7 months ago
tombl|7 months ago
At some point they both decided that Node compatibility was more important than their unique features, but in the time since their release Node got type stripping, require(esm), sqlite, single executable apps, a permission system, a test runner, and basically ever other Deno/Bun feature they could port over.
So at this point why use runtimes that imitate Node when you could just use Node? You'll get most of the modern niceties, but also get 100% compatibility with the existing ecosystem.
reactordev|7 months ago
That said, there’s something to be said about being the first mover and having the ecosystem so node isn’t going away anytime soon, nor is the npm/npx ecosystem.
Go has the ability to, with a goja fork [1], to execute ESM but you would still need to transpile using another go tool to run it. I have such a runtime but it’s nowhere near as fast as bun or deno. I use it mainly so I can have agents do my local bidding.
[1] https://github.com/grafana/sobek
yencabulator|7 months ago
I'm embarking on a project where the various tsconfig files are getting quite unwieldy. I'd have already jumped to Deno but it just won't work right when the actual deployment is to Cloudflare Workers.
gabrielsroka|7 months ago
butz|7 months ago
vivzkestrel|7 months ago
ChrisArchitect|7 months ago
russellbeattie|7 months ago
Like C++, it could be a true superset of JS, importing JS code freely into TypeScript projects. It would also allow TypeScript to do whatever it wanted and not have to worry about transpilation. If it needs to work in the browser, it can be bundled into web assembly.
wrs|7 months ago
(*) with small exceptions like enums, which some think were a mistake for that reason
jasonthorsness|7 months ago
jinushaun|7 months ago
Sacro|7 months ago