You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree this is annoying as I've also occasionally put the wrong thing after await and didn't get any compiler errors.
Having said that, awaiting a non-promise is valid under the spec (although it comes under the heading 'debatable syntax'), and it has well-defined semantics. It is actually convenient in some cases (eg awaiting a value of type T|Promise<T>).
I agree it's annoying but I would not wish something that's currently valid in the ECMA proposal, and that is useful at times, to become an error in TypeScript.
If someone could think up a 'best of both worlds' approach, I'd be all for that.
I'm kind of expecting this to throw an error:
I did a mistake of not using
Promise.all()
:And it would be helpful if TS could help me catch those mistakes.
The text was updated successfully, but these errors were encountered: