Weaken the definition of PromiseLike to allow 'T | awaited T'#37570
Weaken the definition of PromiseLike to allow 'T | awaited T'#37570
Conversation
|
@typescript-bot perf test |
|
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! |
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
|
@rbuckton Here they are:Comparison Report - master..37570
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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. |
|
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 |
|
See also my first fix falsandtru/spica@c569afd We need |
|
Closing in favor of #37610 while we continue to investigate the impact of |
|
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.