- Notifications
You must be signed in to change notification settings - Fork 13.2k
Weaken the definition of PromiseLike to allow 'T | awaited T'#37570
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
rbuckton commented Mar 25, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
rbuckton commented Mar 25, 2020
@typescript-bot perf test |
typescript-bot commented Mar 25, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
typescript-bot commented Mar 25, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @rbuckton, I've started to run the perf test suite on this PR at ed49c32. You can monitor the build here. Update: The results are in! |
typescript-bot commented Mar 25, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
typescript-bot commented Mar 25, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
typescript-bot commented Mar 25, 2020
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
typescript-bot commented Mar 25, 2020
@rbuckton Here they are:Comparison Report - master..37570
System
Hosts
Scenarios
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
falsandtru commented Mar 25, 2020
Can you explain some actual problems caused by the current correct definition? If you weaken the definition, I have to define my correct PromiseLike interface to strictly check the types. |
sandersn commented Mar 25, 2020
The user tests look pretty bad with this change. But I don't know what they were like before. Have they been this broken since first merging |
falsandtru commented Mar 25, 2020
See also my first fix falsandtru/spica@c569afd We need |
rbuckton commented Mar 25, 2020
Closing in favor of #37610 while we continue to investigate the impact of |
typescript-bot commented Oct 21, 2025
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
This weakens the definition of
PromiseLiketo allow thevalueargument to beT | awaited T. This is necessary becausePromiseLikerepresents any promise-like value that can be adopted by a nativePromise. This includes Promise definitions that are not Promise/A+ compatible, such as JQuery'sDeferred. As a result, thevalueargument may or not be recursively unwrapped depending on the implementation.This is intended to work in conjunction with DefinitelyTyped/DefinitelyTyped#43337 to address errors in DefinitelyTyped and other projects following the introduction of
awaited.NOTE: this means that unlike with
Promise, aPromiseLike<Promise<number>>will not be assignable toPromiseLike<number>, as the value may not be recursively unwrapped and therefore we cannot guarantee they are relatable.