Live data from Hacker News

Node.js is able to execute TypeScript files without additional configuration

nodejs.org

231–240 of 275 posts

Re: Node.js is able to execute TypeScript files without additional configuration

#231

Earlier quoted context omitted.

No, it has good defaults. See also: https://prettier.io/docs/option-philosophy

Good to someone, somewhere, telling everyone else what good is. Arguably, code formatters should be configurable, to get a format for your code that you want. Unfortunately, prettier isn't one, and it is a form of regression in many communities at the cost of choice pruning. It might be great for a CI pipeline for constraining how code should look (use prettier, dumbass!), but it isn't great for actually formatting c…

Using it as a precommit hook in OSS projects makes it so that people can write code however they want. But it ends up in the repo following the guidelines of the repo. Minimizing unnecessary back-and-forth with PRs. Extremely useful in my opinion.

Even though prettier has defaults, but they can be modified to quite some extent to suit your projects needs: https://prettier.io/docs/options

Re: Node.js is able to execute TypeScript files without additional configuration

#232
post #161

Earlier quoted context omitted.

Yes, with the difference that Google would have to be compromised in order to poison the go distributable containing fmt tool. With js, it’s enough to poison any single one of the 1400 dependencies of the linter

I forgot that even though fmt will never suffer from middle man attacks downloading the Go toolchain, the standard library already covers 100% of the uses cases someone cares about using Go for, and no one is using CGO.

I used to use CGO quite a lot in linux-embedded environment.

And we had huge dependency chains as well to non-standard library stuff, nowhere near as bad as an average nodejs project but still not free from the problem.

Re: Node.js is able to execute TypeScript files without additional configuration

#233

Earlier quoted context omitted.

Use biome, it doesn't have any external dependencies. eslint should have been put to rest a long time ago.

someone else recommended this too, I'll give it a shot next time I'm in js land.

We added biome to our project, now we have eslint, prettier and biome in the project.

Seriously though it is nice, but migrating away from your existing tooling is painful and underappreciated.

Re: Node.js is able to execute TypeScript files without additional configuration

#234

But still, bun is the winner here. I recently started using bun and now not moving to node.js again. It just works.

Yup, I'm in the same boat. Been using Bun for a year or so, and enjoying the many quality of life improvements. I still use Node when the project requires it, but I'm actively moving them over to Bun when I can. Still it's great to see Node continues to improve in its own way, benefiting a wider audience.

Re: Node.js is able to execute TypeScript files without additional configuration

#235
post #140

Earlier quoted context omitted.

This is great to hear, but perhaps comes too late for people like myself. Node.js has been by go-to platform from around 2014 until last year. But around September last year, I found myself thrust into the .NET ecosystem (due to a client project). Within a few months, I realized that it too, had finally become usable by default (unlike the last time I tried it, when it was too tightly coupled to Windows). In fact, it…

Interesting. I haven't looked hard at .Net despite some advocacy from past colleagues. Perhaps I should.

I can second this experience. I arrived roughly 10 years ago, right in time to see netcore1.0 emerge. Been onboard even since. You should absolutely check it out. The compilation story (native aot) is what I'm currently most excited about it.

Re: Node.js is able to execute TypeScript files without additional configuration

#236

I’m not a heavy JS/TS dev so here’s an honest question: why not use Bun and forget about node? Sure I understand that not every project is evergreen but isn’t Bun a much runtime in general? It supports TS execution from day 1, has much faster dependency resolution, better ergonomics… and I could keep going. I know I’m just a single data point but I’ve had a lot of success migrating old node projects to bun (in fact I…

Node is much more stable than bun. bun has numerous crash bugs, something that is unheard of with Node.

Re: Node.js is able to execute TypeScript files without additional configuration

#237

Earlier quoted context omitted.

You mean TypeScript. TypeScript is finally usable by default.

I mean Node. I find writing Node in JS intolerable. ESM, --watch, and TS syntax support is the combo that makes it all good!

Well, only goes to show how different everyone's experiences are. I guess I've had the opposite one: Node+CommonJS was something I was extremely comfortable with.

The slow adoption of ESM by Node, with many compatibility missteps, the thousand papercuts around TS, the way frontend-centric toolchains kinda-sorta paper over the whole thing, letting it fester, and the way people have been acting like things are ready for primetime for over a decade while diligently testing them in production, all of that came later. To the point of having me wondering how did people work with TypeScript before ~5.4 - though evidently they did, and had few if any of the same complaints!

Baffling but IIWII. Anyway, only this year I discovered a pure `tsx` + ESM workflow had become viable OOTB, to no little surprise. I perceive that as the toolchain becoming unfucked just as randomly as it became fucked when Node 16 did what it did. Not that it didn't take a couple years for TS to "invent" the right compiler flags that it took to tell it to stay out of the runtime's way, too.

So a good year overall. Hope they don't break it again because when they do it's an uphill struggle to convince them that they have.

Re: Node.js is able to execute TypeScript files without additional configuration

#238
post #140

Earlier quoted context omitted.

This. It's 2025 and the node ecosystem is finally usable by default! ESM modules just work with both Node and Typescript, Node can run .ts files, and there's the a good enough test runner built in. --watch. The better built in packages - `node:fs/promises` - are nice with top-level await for easier async loops. It took a while to convince everyone involved to just be pragmatic, but it's nice now.

This is great to hear, but perhaps comes too late for people like myself. Node.js has been by go-to platform from around 2014 until last year. But around September last year, I found myself thrust into the .NET ecosystem (due to a client project). Within a few months, I realized that it too, had finally become usable by default (unlike the last time I tried it, when it was too tightly coupled to Windows). In fact, it…

Eh the focus on OOP is my main issue with it. It’s not my style in that sense.

Re: Node.js is able to execute TypeScript files without additional configuration

#239

Earlier quoted context omitted.

It's still probably better to use Bun.

Deno 2 is (arguably) just as compelling.

You're being downmodded for not providing any supporting arguments, but there's some compelling protection for malicious modules in these other JS implementations.

Re: Node.js is able to execute TypeScript files without additional configuration

#240
post #222
post #4

Impressed with what Node is doing the last years, deno and bun has really made Node focus and improve. It was stuck for a while

They added type striping, not full TS support. And the biggest issue with Node IMO is that the standard lib still forces you to rely on endless npm dependencies. Node is still very much stuck.

> the standard lib still forces you to rely on endless npm dependencies

How? We have async/await file access, a async/await test runner, and even async/await sleep built in. What are you missing?

Post reply on HN