Live data from Hacker News

Node.js adds experimental support for TypeScript

github.com

281–290 of 570 posts

Re: Node.js adds experimental support for TypeScript

#281
post #239
post #215

Earlier quoted context omitted.

TypeScript feels "boring" enough at this point that being a few years behind isn't gonna be an issue in most cases. For teams who want to stay on the absolute latest release of TypeScript but want to be more conservative with their Node version, external compilation will remain necessary; but for someone like me, where TypeScript has been "good enough" for many years that I'm not excited by new TypeScript releases, t…

typescript is still evolving in dramatic ways. The 5.0 release has some really good improvements

But at the same time, it's good enough and has been good enough for many years. It's like how I'm sure EcmaScript 2024 contains cool new stuff, but if node only supported ES6, I would have no trouble writing ES6.

Re: Node.js adds experimental support for TypeScript

#282
post #13

Earlier quoted context omitted.

But in the meantime you suffer for it. How many days have you spent on webpack config? Or the package.json type property? Or yarn/pnpm/etc particulars? I have spent too many. Bun is quite nice.

Is Bun's bundler on par with webpack for features? You can't escape webpack* if you're targeting frontend. *Or vite, or whatever equivalent.

Using vite is escaping webpack!

Re: Node.js adds experimental support for TypeScript

#283
post #160
post #99

Earlier quoted context omitted.

> we all just wanted java with JIT, more feature rich type system Java has JIT. How is TypeSript type system feature-richer than the Java one?

Java and Typescript have fundamentally different type systems, that lead to drastically different ways to approach types. Utility types, like Partial , are basically impossible to represent in Java except with almost-duplicated classes.

> drastically different ways to approach types

Exactly.

> Partial

Looking at that it's just what a default POJO (with nullable properties) already is, so I'd see no need to represent that in Java.

Looks cool though and I like Typescript; my issue with it is that it needs transpiling to run. If it was a first-class citizen in an environment I would use it for my pet projects.

Re: Node.js adds experimental support for TypeScript

#285
post #203

Earlier quoted context omitted.

This is a persistent meme that has no basis in reality. A TypeScript engine is a JavaScript engine, since everything that can be done in JS can be done in TS. It's plausible, maybe, that there could be some additional optimisations on TS code where the engine is sufficiently happy with all types in a subset of the program. But that would be on top of all existing JS engine features, unless you want your engine's perf…

That's a pretty obtuse interpretation of the comment. Browsers natively being able to run Typescript code / .ts files instead of requiring transpiling to plain Javascript would be a large boon to the TS ecosystem by making basically everything easier. Even if it's just stripping the TS and running the plain JS it would already be helpful, but it running the typechecking beforehand would be wonderful.

Maybe I was reading too much into the comment I replied to, but to me "a typescript engine" implied more than "ignoring the types" (which is the current TC39 proposal).

And I was replying based on what I've seen other people saying whenever the subject comes up; apologies if I misread.

Browsers doing type checking is a pretty fraught idea IMO, at least with Typescript and not some other statically typed language entirely.

Re: Node.js adds experimental support for TypeScript

#286
post #219

Earlier quoted context omitted.

Isn't Bun too raw? It's built with Zig, which hasn't even hit 1.0.

Probably had to stay in the oven a bit longer... Jokes apart, Zig is moving forward a lot which is why it's not 1.0 yet, but it doesn't mean you can't write safe and performant applications right now. Zig is also a rather simple and straightforward language (like C) and has powerful compile-time code generation (like C macros, but without the awful preprocessor).

I'm more worried about compilation or stdlib bugs. In theory you can do lots of things with lots of things, but in practice there are all sorts of hidden limitations and bugs that tend to be noticed once a software product is past 1.0 and has been out in the wild for half a decade or more.

Re: Node.js adds experimental support for TypeScript

#287

One thing to note is that it is impossible to strip types from TypeScript without a grammar of TypeScript. Stripping types is not a token-level operation, and the TypeScript grammar is changing all the time. Consider for example: `foo ( x )`. In TypeScript 1.5 this parsed as (foo (x)) because bar&baz wasn’t a valid type expression yet. When the type intersection operator was added, the parse changed to foo (x) which…

Using inequality signs as angled brackets really is a mistake isn't it...

Re: Node.js adds experimental support for TypeScript

#288

Earlier quoted context omitted.

“During the transpilation process, no type checking is performed, and types are discarded.” this node feature is primarily around disregarding typescript in favor of the underlying javascript it represents. that reminds me of this fun article: https://www.richard-towers.com/2023/03/11/typescripting-the-...

Yes, the feature is about being able to run typescript scripts. It’s not a type checker, it is similar to ts-node, deno, bun, etc. Typescript has been designed for that specific purpose.

seen and heard, my original point was that typescript is not poised to be a tc39 standard.

this is still a “runs some typescript” and “not runs every typescript file”

“ At least initially in this PR no trasformation is performed, meaning that using Enum, namespaces etc... will not be possible.”

this type of nuance is the core of why typescript is a headache for any organization with more than a single codebase— javascript is portable, typescript is in theory, but not in observed practice.

Re: Node.js adds experimental support for TypeScript

#290

Earlier quoted context omitted.

https://www.typescriptlang.org/docs/handbook/2/types-from-ty... https://www.typescriptlang.org/docs/handbook/2/template-lite... alone puts TS over anything that Java has.

> alone puts TS over anything that Java has. Virtual Threads alone challenge this assumption. Syntax bloat is not a feature.

Virtual Threads are not a type system feature?
Post reply on HN