-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: Warn when using await on PromiseLike #39387
Comments
Thoughts @rbuckton? |
I'm not sure I understand why you would issue a warning on I'm not familiar with |
|
The All that |
Sorry for the noise. Turns out there's some brittle stuff with proxying that muddles the typing here. chaijs/chai-as-promised#266 (comment) |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
TypeScript Version: 3.7.x-dev.201xxxxx
Search Terms:
PromiseLike await
Code
Expected behavior:
There should be warning on the line with const c. I found this while using chai-as-promised. "await expect(promise).to.eventually.be(arg)" was throwing UnhandledPromiseRejectionWarning. Chai.PromisedAssertion is a PromiseLike and not a Promise (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/chai-as-promised/index.d.ts#L105) and it's not safe to use with await. But the type system hid that from me.
Actual behavior:
No warning.
Playground Link:
https://www.typescriptlang.org/play/index.html?ssl=10&ssc=2&pln=1&pc=1#code/MYewdgzgLgBADgJxAWwJYQKYEEYF4ZgYDuMACkmpgBQIYQgA2AbhngHwwDeAUDDLfWYYqAVgCUAbm4BfMd24BDCAE8wwGADMArmqipwMZAtRgqYrrxihIsBXhgKix2CKl9r0GACN7j5-Ap0bDcrcE91fD9UWCpOaQcIMkDMABlUAGsMAB4wLWQvDAQ2SXlpIA
Related Issues:
#35419
The text was updated successfully, but these errors were encountered: