Closed
Description
Bug Report
π Search Terms
tuple, array, promise, async, function, inference
π Version & Regression Information
v4.3.5
β― Playground Link
Playground link with relevant code
π» Code and behavior
// β Type '(string | number)[]' is not assignable to type '[one: number, two: string]'.
const nowork: Promise<[one: number, two: string]> = (async () => {
return [1, 'two'];
})();
π Expected behavior
As with supplying an instance of Promise, correctly infer returned value as assignable to the variable.
// β
const yeswork: Promise<[one: number, two: string]> = new Promise(
(resolve) => resolve([1, 'two']),
);