Live data from Hacker News

Node.js adds experimental support for TypeScript

github.com

121–130 of 570 posts

Re: Node.js adds experimental support for TypeScript

#121
post #99

I really enjoy typescript and have been yearning for a typescript runtime but I can't help but laugh that I left java all those years ago to finally seek something a lot closer to java. I guess we all just wanted java with JIT, more feature rich type system and gradual typing. Also for all the shortcomings of npm ecosystem, it is a lot less daunting and more fun to be using libraries in this ecosystem. And surprising…

> 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?

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.

Re: Node.js adds experimental support for TypeScript

#123

I really enjoy typescript and have been yearning for a typescript runtime but I can't help but laugh that I left java all those years ago to finally seek something a lot closer to java. I guess we all just wanted java with JIT, more feature rich type system and gradual typing. Also for all the shortcomings of npm ecosystem, it is a lot less daunting and more fun to be using libraries in this ecosystem. And surprising…

Typescript is way better than Java, in my experience. It's a lot less verbose. A lot more flexible.

They are not comparable. If anything, Kotlin is the equivalent in the JVM universe.

Re: Node.js adds experimental support for TypeScript

#124

I have mixed feelings about this. While I do use TS with Node.js today and absolutely like the concept, its type system is still far from something mature and stable like C#. We keep running into ceilings (EDIT: lack of completeness/depth, not lack of complexity) all the time, and TypeScript questions on Stack Overflow is basically a library of workarounds. Mostly bad ones. So if I worked on Node.js I would prefer it…

What's an example of a ceiling? Out of all the mass-market programming languages, TS arguably has the most advanced type system in the world. It's a modern marvel that they got it working on top of Javascript.

Certainly advanced, but not mature in my experience. Using e.g. classes and inferred generic function arguments, quickly reveals a lot of features that are missing. Often some similar feature is present but it lacks depth/completeness. Lots of good discussions to read in TS repo on GitHub if you're interested: Optional generic type inference, extends oneof, generic values, keyof a subset, conditional types, etc.

I want to emphasize that the reason we keep running into "ceilings" is probably because of its advanced type system. Libraries and frameworks are using those type features and when we can't keep building on the type - we end up casting to unknown and reconstructing it. Which feels worse than not being able to construct that complex type at all.

Re: Node.js adds experimental support for TypeScript

#125
post #93

Earlier quoted context omitted.

Java does jit

Yes, JIT was not the right terminology to use. I lazily wrote JIT. Apologies. What I meant to convey was the difference in startup times and run time between running something in JVM and V8. Java feels heavy but in javascript ecosystem it feels so nimble.

Native Java via GraalVM starts up in milliseconds.

Re: Node.js adds experimental support for TypeScript

#126

Earlier quoted context omitted.

Before that there was the closure compiler (Google) which had type annotations in comments. The annotation syntax in comments was a little clunky but overall that project was ahead of it's time. Now I believe even inside google that has been transpiled to typescript (or typescript is being transpiled to closure, I can't remember which - the point is that the typescript interface is what people are using for new code)…

Oh, Closure Compiler is such a throwback. I still remember staring at the project page on Google Code. Isn't it like two decades old or even older by this point? Is it still alive?

Closure is still used in Emscripten to optimize the generated Javascript shim file.

Re: Node.js adds experimental support for TypeScript

#127

I really enjoy typescript and have been yearning for a typescript runtime but I can't help but laugh that I left java all those years ago to finally seek something a lot closer to java. I guess we all just wanted java with JIT, more feature rich type system and gradual typing. Also for all the shortcomings of npm ecosystem, it is a lot less daunting and more fun to be using libraries in this ecosystem. And surprising…

> Also for all the shortcomings of npm ecosystem, it is a lot less daunting and more fun to be using libraries in this ecosystem.

God I wish they’d just integrate something lightweight like npm into JDK.

It is beyond me why you have to install third-party heavy weight tool just to manage dependencies.

Re: Node.js adds experimental support for TypeScript

#128

Earlier quoted context omitted.

Yes, JIT was not the right terminology to use. I lazily wrote JIT. Apologies. What I meant to convey was the difference in startup times and run time between running something in JVM and V8. Java feels heavy but in javascript ecosystem it feels so nimble.

Native Java via GraalVM starts up in milliseconds.

And it has to go through slow compilation step. With Node you can have a cake and eat it too.

Re: Node.js adds experimental support for TypeScript

#129
post #28

I'm honestly giddy. This could be the (slow) beginning of a new era, where "JS with types" is finally a native thing. I'm even willing to forgive all the mess that CJS vs. ESM is if they manage to pull this off. I hope this sees widespread adoption/usage, which might finally cause some movement to integrate TS into ecmascript after all. Some dynamically-typed language fanatics (which are, in my opinion, completely de…

> the reality that static types are what the vast majority of devs want

[citation needed]

Re: Node.js adds experimental support for TypeScript

#130
post #119
post #111

Earlier quoted context omitted.

1. *Type Inference*: TypeScript can automatically infer types from context, reducing the need for explicit type declarations. 2. *Union and Intersection Types*: Allows combining multiple types, offering more flexibility in defining data structures. 3. *Literal Types*: TypeScript supports exact values as types (e.g., specific strings or numbers), which can be useful for more precise type-checking. 4. *Type Aliases*: Y…

That's just an copy-paste of some features, not a comparison with Java which does most of that too.

Union types, structural typing, and conditional types are like a big chunck of what makes typescript typescript.

It is how TS is able to "type" a completely untyped language.

Just the support for union types is something that not even Haskell or Ocaml have.

Post reply on HN