2 ms·
> 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 runt
by black3r 2y ago
> 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.
- pansa2 2y ago> 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-future-for-typing/34225/32 https://discuss.python.org/t/a-more-useful-and-less-divisive...