TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

ECMAScript Proposal: Types as Comments

65 pointsby 0xedbabout 3 years ago

8 comments

dlbucciabout 3 years ago
This topic came up earlier this week, and I just don&#x27;t see what the big win is. I guess people want to be able to skip setting up a build system for TypeScript, but if you do that, you&#x27;ll be sending a bunch of extra junk to browsers that will just be ignored. So you&#x27;ll need to setup a minifier to strip it all out, which means you have to setup a build system anyway.<p>Is there some other advantage? Easier debugging on the client, I guess, but proper source maps do that pretty well already. I dunno, this just seems to be making a complex language more complex for not much gain.<p>That said, if the runtime actually used the types for safety or performance, I could maybe see some value added there.
评论 #30655189 未加载
评论 #30656396 未加载
评论 #30655114 未加载
mattlondonabout 3 years ago
Why go to the effort of doing all of this, but not use typescript? I don&#x27;t see the point - they mention ignoring the build step, but it&#x27;s not like that is particularly annoying at the moment, at least not in the largish-projects I&#x27;ve worked on (enterprise angular apps staffed by approx 50-60 frontend engineers, so fairly chunky codebase)
评论 #30655866 未加载
评论 #30660172 未加载
TazeTSchnitzelabout 3 years ago
Ignoring the type declarations gives some freedom to type checkers to decide what meaning they have, but it also makes them useless to the runtime. I think that&#x27;s a shame. Could JavaScript engines not benefit from the type information? PHP does.
评论 #30656030 未加载
sergiomatteiabout 3 years ago
Dumb question incoming… Why not formalize TypeScript into the ECMAScript spec?
评论 #30654957 未加载
评论 #30654793 未加载
评论 #30654818 未加载
评论 #30659969 未加载
评论 #30654917 未加载
评论 #30654768 未加载
0xCAPabout 3 years ago
This feels completely unneeded and a huge step backwards. Sure, TypeScript&#x27;s language server is slow af, and making it better is no easy task, but TypeScript&#x27;s syntax and overall language mechanics are the best I&#x27;ve ever used and I&#x27;m not trading them for whatever DX improvement this stuff promises to bring.
orangepandaabout 3 years ago
This proposal doesnt support the full typescript syntax, you&#x27;ll need a build step anyway. What problem does it solve?
评论 #30655210 未加载
评论 #30659949 未加载
montroserabout 3 years ago
Previous discussion: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30626458" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30626458</a>
olliejabout 3 years ago
Is this the same bad idea from MS earlier this week, or is it a completely different spec of the same bad idea?<p>There are many reasons this concept of “unenforced type syntax” is flawed, and from the threads for the MS proposal there are already JS consoles&#x2F;CLIs that support TS.