News for hackers. Stuff that matters.
Re:Node.js adds experimental support for TypeScript by black3r on Thursday July 25, 2024 @04:40AM (#41066307)
> If Node.js can run TypeScript files directly, then the TypeScript compiler won't need to strip types and convert to JavaScript

Node.JS isn't the only JS runtime. You'll still have to compile TS to JS for browsers until all the browsers can run TS directly. Although some bundlers already do that by using a non-official compiler, like SWC (the one Node's trying out for this feature).

> In Python, I've even heard of people writing types in source code but never checking them, essentially using type hints as a more convenient syntax for comments.

It's not just comments. It's also, like the name "type hint" suggests, a hint for your IDE to display better autocomplete options.

Re:Node.js adds experimental support for TypeScript by pansa2 on Thursday July 25, 2024 @05:24AM (#41066589)
> It's not just comments. It's also a hint for your IDE to display better autocomplete options.

Ah yes, autocomplete is another benefit of machine-readable type hints. OTOH there's an argument that another IDE feature, informational pop-ups, would be better if they paid more attention to comments and less to type hints:

https://discuss.python.org/t/a-more-useful-and-less-divisive...