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
Complains that constructor is not compatible with Promise's constructor. (Uncomment | PromiseLike<T> and there is no compile error.)
Actual behavior:
Complains that then is incompatible. But it's identical to the one in PromiseLike.
src/a.ts(8,34): error TS1055: Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
src/a.ts(8,34): error TS1055: Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
Type 'TPromise<T | PromiseLike<T>>' is not assignable to type 'PromiseLike<T>'.
Types of property 'then' are incompatible.
Type '<TResult1 = T | PromiseLike<T>, TResult2 = never>(onfulfilled?: (value: T | PromiseLike<T>) => TR...' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, on...'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type 'T | PromiseLike<T>' is not assignable to type 'T'.
Type 'PromiseLike<T>' is not assignable to type 'T'.
@HunderlineK If you are targeting ES5 then you cannot use a type alias in the return type of an async function as the return type must resolve to a constructor in the value space, not just the type space.
TypeScript Version: nightly (2.5.0-dev.20170629)
Code
Expected behavior:
Complains that
constructor
is not compatible withPromise
's constructor. (Uncomment| PromiseLike<T>
and there is no compile error.)Actual behavior:
Complains that
then
is incompatible. But it's identical to the one inPromiseLike
.Discovered in microsoft/vscode#30216
The text was updated successfully, but these errors were encountered: