Closed
Description
TypeScript Version: 3.7.x-dev.20200111
Search Terms:
Code
declare function f(cb: (v: boolean) => [0] | PromiseLike<[0]>): void;
f(v => v ? [0] : Promise.reject()); // ok
f(async v => v ? [0] : Promise.reject()); // error
Expected behavior:
pass
Actual behavior:
Type 'Promise<number[]>' is not assignable to type '[0] | PromiseLike<[0]>'.
Type 'Promise<number[]>' is not assignable to type 'PromiseLike<[0]>'.
Types of property 'then' are incompatible.
Type '<TResult1 = number[], TResult2 = never>(onfulfilled?: ((value: number[]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>' is not assignable to type '<TResult1 = [0], TResult2 = never>(onfulfilled?: ((value: [0]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => PromiseLike<...>'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Property '0' is missing in type 'number[]' but required in type '[0]'.(2322)
Related Issues: