You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type of newPromise, based on the overload, is Promise<string>. However, because the onRejected function doesn't throw or return a rejected promise, newPromise becomes a resolved promise with the return value of onRejected, which is void, which means that newPromise should be Promise<T | void>. Specifically, this code should not compile:
newPromise.then((value: string)=>{// value should be `(string | void)`, since it could have a//value from the `onRejected` branch});
The text was updated successfully, but these errors were encountered:
es6-promise/es6-promise.d.ts
Line 3 in 9869a4b
One of the overloads for
Thenable.then
is:However, consider this example:
The type of
newPromise
, based on the overload, isPromise<string>
. However, because theonRejected
function doesn't throw or return a rejected promise,newPromise
becomes a resolved promise with the return value ofonRejected
, which isvoid
, which means thatnewPromise
should bePromise<T | void>
. Specifically, this code should not compile:The text was updated successfully, but these errors were encountered: