Conversation
|
👍 |
| /** | ||
| * Creates a new Promise with the same internal state of this Promise. | ||
| * @returns A Promise. | ||
| */ |
There was a problem hiding this comment.
I thought overloads should be arranged longest-to-shortest to make sure that the most restrictive overloads matches first. Why change that here?
|
The change in 9d4219a fixes an existing issue with assignability between |
| * @returns A Promise for the completion of which ever callback is executed. | ||
| */ | ||
| then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; | ||
| then(onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>; |
There was a problem hiding this comment.
This overload is meant to replace then(): Promise<T> as that overload was one of the causes of #10524.
|
👍 |
|
@mhegazy, do you want to take this change for release-2.0 as well? |
|
no. jsut 2.1 please. |
This change modifies the overloads for
thenandcatchofPromise<T>, and the overloads forthenofPromiseLike<T>to provide better type inference.Fixes #4903