Live data from Hacker News

Node.js adds experimental support for TypeScript

github.com

351–360 of 570 posts

Re: Node.js adds experimental support for TypeScript

#351
post #159

Earlier quoted context omitted.

Kotlin is much closer to Java than to TypeScript even in terms of flexibility.

To me "Flexibility" sounds a lot like "The programmer always knows what he does".

Flexibility means for me more something more like, I think I know what I want to do but I also know that I'm probably wrong about that, so for now let's skip all the baroque protocol and let me make it work first. Once I'm sure I wrote what I actually wanted I'll add types if only to get rid of some bugs, consider edge cases and earn nice code completions and auto-generated docs.

Re: Node.js adds experimental support for TypeScript

#353

I might be ignorant but wasn't there a plan to add Typescript support to the browser itself? In which case wouldn't V8 support TS directly without needing to transpile?

Yes. That is noted in the PR:

> There is a TC39 proposal for type annotations

Which links to https://github.com/tc39/proposal-type-annotations

It is a long ways off though.

Re: Node.js adds experimental support for TypeScript

#354

Earlier quoted context omitted.

> the reality that static types are what the vast majority of devs want [citation needed]

https://github.com/tc39/proposal-type-annotations?tab=readme... You’re welcome.

This is not what GP asked for. That's the most requested feature from the state of JS survey.

I bet the percentage of web developers who want this are a tiny minority. There are just too many issues with this.

Static typing without the benefits of better runtime performance, soundness, strong typing etc. is basically just documentation/comments with extra steps.

Also TS is a complex, moving target. Most devs don't want to learn new fancy features every couple of months, but prefer stability guarantees. Several notable projects have moved away from TS. Even Ryan Dahl admitted that integrating Deno with TS was probably a mistake.

Meanwhile you have WASM slowly and steadily getting crucial features on a sound foundation.

I'm extremely cautious about TS and wary of the hype surrounding it.

Re: Node.js adds experimental support for TypeScript

#355

I beg of thee, do not do this. I get that people love typescript but I am already running into a problem where javascript resources are written in typescript by default with nothing for regular javascript. This is the same problem that happened when JQuery hit its peak popularity and an overwhelming amount of resources and guides amounted to "Oh just do this in JQuery"

Tell me you're out of touch without telling me that you're out of touch.

jQuery was so popular because writing anymore than a few lines of vanilla JavaScript was an *awful* experience due to all differences in browsers.

When things eventually standardized-ish and jQuery became unnecessary, other libraries/ecosystems popped up (e.g. React/JSX) to make writing webapps easier because writing anymore than a few lines of vanilla JavaScript was still an *awful* experience.

When webapps grew in size and scope, other "transpiled" languages popped up (e.g. TypeScript) because writing anymore than a few lines of vanilla JavaScript is *still an awful* experience.

We're stuck with JavaScript due to past decisions, but let's not pretend it's actually a good tool. If it were we wouldn't need 50,000 tools/frameworks/transpiled languages to hide how terrible it is.

Re: Node.js adds experimental support for TypeScript

#356

It's been a really eventful month for Node. First they added node:sqlite in v22.5.0, and now TypeScript support is landing. I love the direction Node is heading in.

The recently-added test runner is very cool too!

I just started using it the other day and it’s a dream. I look forward to the eventual stability of their snapshot testing.

Re: Node.js adds experimental support for TypeScript

#357
post #34

If Node.js can run TypeScript files directly, then the TypeScript compiler won't need to strip types and convert to JavaScript - it could be used solely as a type checker. This would be similar to the situation in Python, where type checkers check types and leave them intact, and the Python interpreter just ignores them. It's interesting, though, that this approach in Python has led to several (4?) different popular…

Flow (by Facebook) used to be fairly significant in the JavaScript several years ago, but right now it's somewhat clear that TypeScript has won rather handily.

There was no real competition, Flow was a practical internal tool with 0 marketing budget. Typescript is typical MS 3E strategy with a huge budget. Needless to say, Flow is much more practical and less intrusive, but marketing budget captured all the newbie devs.

Re: Node.js adds experimental support for TypeScript

#358
post #337

Earlier quoted context omitted.

> it's just what a default POJO (with nullable properties) already is I think you missed the point. Partial is an example of a "mapped type", see the handbook for more explanation: https://www.typescriptlang.org/docs/handbook/2/mapped-types....

I understand that much, just thinking aloud what problem would that solve in Java.

I think it's for when you need type that expresses partial data update for an object that has some fields required.

Re: Node.js adds experimental support for TypeScript

#359
post #246

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)…

Closure is almost a forgotten child of Google now. Does not even fully support ES2022 as of today. We are working hard to get rid of it completely. Surprise, lots of important projects still rely on it today.

This is true. For instance, React still uses Closure compiler in their build process.

Re: Node.js adds experimental support for TypeScript

#360

I might be ignorant but wasn't there a plan to add Typescript support to the browser itself? In which case wouldn't V8 support TS directly without needing to transpile?

all browsers would have to agree, the language would have to be very well defined and well supported across all those browsers.

that would be a lot of work

I would rather see new WASM features instead

Post reply on HN