Hacker News new | ask | show | jobs
by wolfadex 1565 days ago
Everyone keeps saying variations of "It would become possible to program (e.g.) TypeScript without compiling the source code." but that's not true. This proposal is only a subset of TypeScript, meaning that all of the existing TS infrastructure would remain and still be used. All this does is further bloat the ECAMScript for no gain.
5 comments

I agree that there are problems with limiting this to a subset. But for the most part it’s a very good subset that mostly only removes features which would be rejected if proposed today, because they have runtime semantics. This would effectively deprecate those features in the real world. I’m in the minority who likes enums, but I can live without them. The real, big gap here is JSX. But that rightly should be a separate proposal. I just want them to consider it a prerequisite, to avoid fracturing that aspect of TS.
I agree. The TC39 committee process has had a lot of advantages in modernizing the language, but in the last 3-5 years we've seen the pace of merging new language features grow in an unprecedented fashion. There are advantages to evolving the language but there is also a risk that the syntax becomes bloated if there is not enough deliberation within the standards process.
I like the idea of TypeScript, and am learning it, but am disappointed that we're still using build systems for JavaScript. I thought modules, HTTP2, and evergreen browsers would allow us to write just plain JS (like the olden times!), and not have to worry about bundling, but I guess not.
You'll still want to compile (or more specifically, type-check and minimise), but you'll probably be able to run your TS code without compiling, if you stick to that subset - but that'll likely be pretty easy. I'm imagining lint rules like the ones we're using to restrict ourselves to const and let instead of var, and things we'll quickly internalise like avoiding enums, and things we're no longer using anyway, like namespaces. Yes, it's a subset, but includes enough that you don't need the infra to run it.
This was my first thought as well, but I do think it could still be useful, even if not all TypeScript can be run as pure JavaScript. There's a lot of use cases where some type hinting would be useful, but the full feature set of TypeScript is not necessary. Long term, I could see a world where these features effectively replace TypeScript, which could help simplify dev pipelines.
How would these features replace TypeScript? TypeScript is more than just a syntax as it also requires a compiler, config, IDE tooling, and typically additional plugins to make it compatible with testing tools and bundlers.