I wish TS could check Promise resolve types, so like: foo(): Promise<boolean> { return new Promise(res => res(123)); // NO }
-
-
by "it can" do you mean "it currently does, as written", or are there additional steps to make that example work?
-
This works: foo(): Promise<boolean> { return new Promise<boolean>(res => res(123)); // NO } 1/
-
The inference engine isn't connecting the two normally (the return type and the constructor are really generic) 2/
-
thanks to the ability to do things like res(promiseLike) or res() 3/3
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.