Bug Report
🔎 Search Terms
overload, array.prototype.map
🕗 Version & Regression Information
- This is the behavior in every version I tried.
⏯ Playground Link
Playground link with relevant code
💻 Code
declaretypeObj={a: true};declareconstarr: Array<string|Obj>;declarefunctionfunc(url: string|Obj): string;declarefunctionfunc<TextendsObj|string>(url: T): string|null;constfails: string[]=arr.map(func);// ^^^ Type '(string | null)[]' is not assignable to type 'string[]'.constworks: string[]=arr.map((v)=>func(v));interfaceCustomArray<T>{map<U>(callbackfn: (value: T)=>U): U[];}declareconstarr2: CustomArray<string|Obj>;constfails2: string[]=arr2.map(func);// ^^^ Type '(string | null)[]' is not assignable to type 'string[]'.constworks2: string[]=arr2.map((v)=>func(v));🙁 Actual behavior
It fails to select the correct overloard.
🙂 Expected behavior
It is supposed to select the correct overload.
Bug Report
🔎 Search Terms
overload, array.prototype.map
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
It fails to select the correct overloard.
🙂 Expected behavior
It is supposed to select the correct overload.