TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

ts-blank-space is a fast type-stripping compiler

48 点作者 joatmon-snoo8 个月前

10 条评论

cardanome8 个月前
Or maybe just use jsdoc at this point and skip the compile step completely. Though i admit it is not as pretty to read but you can get used to it.<p>Still a nifty new tool though. I wish JS would just allow type declarations at this point. It doesn&#x27;t need to enforce them, just allow them like Python does. That would be amazing.
评论 #41654335 未加载
评论 #41654933 未加载
评论 #41654588 未加载
thecodrr8 个月前
You&#x27;d already be using source maps in any real-world scenario so I am not sure what&#x27;s the value proposition here outside of &quot;just for fun, I guess&quot;.<p>The tsc transpilation to lower ES versions is actually really useful when using not-so-recent Node versions. Not to mention this severely restricts TypeScript syntax to &quot;just types&quot; which isn&#x27;t too bad but it means you now have to worry about yet another thing.<p>Then there&#x27;s the ESM &amp; CJS mess. You almost always want to export in both formats which will change a lot of the syntax, so this quickly falls apart for anything serious.<p>Just use esbuild if you want speed.
评论 #41652671 未加载
评论 #41654463 未加载
评论 #41654323 未加载
yonran8 个月前
Cool. Reminds me of a similar program to convert python3 code to python2, which similarly converts the typing into spaces to preserve row and column numbers: <a href="https:&#x2F;&#x2F;github.com&#x2F;abarker&#x2F;strip-hints">https:&#x2F;&#x2F;github.com&#x2F;abarker&#x2F;strip-hints</a>.
Waterluvian8 个月前
I wish enum was never part of TypeScript. It’s this one odd thing unlike the rest.<p>Am I forgetting any or is it the only feature that actually generates code rather than just being extra annotation?
评论 #41653470 未加载
评论 #41653598 未加载
评论 #41653956 未加载
评论 #41655939 未加载
评论 #41653695 未加载
paulddraper8 个月前
&gt; We refer to the supported subset as Modern TypeScript because it represents nearly all TypeScript syntax, except for those TypeScript-specific features that may be considered legacy or discouraged in some way<p>&gt; These unsupported TypeScript features already have preferred alternatives:<p>&gt; Prefix-style type assertions (&lt;type&gt;value) should be replaced with as-style type assertions.<p>Am I out of date? Does someone know something I don&#x27;t?
评论 #41653656 未加载
mridang8 个月前
Doesn&#x27;t the new node feature to strip types handle this already? <a href="https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F;learn&#x2F;typescript&#x2F;run-natively" rel="nofollow">https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F;learn&#x2F;typescript&#x2F;run-natively</a><p>I haven&#x27;t used it as I haven&#x27;t had a need for it.
评论 #41707442 未加载
rendall8 个月前
This is such a simple idea that it seems like it shouldn&#x27;t work. Pretty nifty.
MBlume8 个月前
I&#x27;m a little confused about when I&#x27;d use this, if I&#x27;m quickly iterating on code as I develop it, probably I also want to know whether it type checks, right?
评论 #41653631 未加载
umvi8 个月前
&gt; Today, it appears to be the fastest emitter written in JavaScript<p>JavaScript is really slow though compared to golang. For that reason I prefer esbuild for type-stripping.
peterldowns8 个月前
I am shocked to not see a reference to Taylor Swift’s hit song Blank Space anywhere in the article!
评论 #41652737 未加载
评论 #41652704 未加载
评论 #41653275 未加载
评论 #41654365 未加载
评论 #41652987 未加载