DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.56k stars 33 forks source link

Fix automatic `Promise` wrapping of async return types #1619

Closed edemaine closed 1 day ago

edemaine commented 1 day ago

Our current AutoPromise wrapper is broken in many cases. TS seems to be splitting up AutoPromise<A | B> into AutoPromise<A> | AutoPromise<B> which fails the check for a single Promise<...> wrapper.

But the arguably simpler Promise<Awaited<T>> wrapper seems to work great!

This shouldn't affect help hovers; the user will still see AutoPromise<their type> just as before (that's why we gave it a name in the first place).