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.

Automatically add missing "async/await" keywords to your TypeScript code

7 pointsby theThree20 days ago

4 comments

primitivesuave18 days ago
I took a peek at the implementation - I think this only works for a case where the typing explicitly contains the string &quot;Promise&quot;. For example, I don&#x27;t think it would work if I use `SomeInterface[&quot;some_promise_key&quot;]` or might incorrectly add an async if I use `Awaited&lt;Promise&lt;...&gt;&gt;`.<p>I think what you&#x27;re trying to build might be best served by Typescript&#x27;s VFS - <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@typescript&#x2F;vfs" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@typescript&#x2F;vfs</a>. You can load the local files into an in-memory type system, and quickly extract async&#x2F;await hints that might be more useful for a typical TS developer. I think there&#x27;s a lot of really interesting static analysis you could do to improve async&#x2F;await safety, as it certainly leads to issues from time to time.
bastawhiz18 days ago
Is this a problem that people actually have?
joshstrange18 days ago
I do not want to be mean but I think you&#x27;d be much better served with ESLint rules to yell at you when you don&#x27;t await when you should or do when you shouldn&#x27;t.<p>This should _not_ be an automatic operation since it can change behavior in ways that will be unclear to the developer (completely undoing any gain from them being added automatically).
评论 #43914146 未加载
评论 #43899940 未加载
xeromal18 days ago
Fun side project man!