Closed
Description
TypeScript Version: Version 4.1.0-dev.20200909
Search Terms: map not callable
Code
function foo<T>(o: T) {
if (Array.isArray(o)) {
o.map(() => {});
}
}
Expected behavior: It should work as it does in 4.1.0-dev.20200908.
Actual behavior:
abc.ts:3:9 - error TS2349: This expression is not callable.
Each member of the union type '(<U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]) | (<U>(callbackfn: (value: any, index: number, array: readonly any[]) => U, thisArg?: any) => U[])' has signatures, but none of those signatures are compatible with each other.
3 o.map(() => {});
~~~
Found 1 error.
Playground Link: It somehow shows no error on playground. https://www.typescriptlang.org/play?ts=4.1.0-insiders.20200909#code/GYVwdgxgLglg9mABMOcA8AVAfACgA4CGATgQLYBciGAlIgN4CwAUIq4jMIjgIJEkCeAOhgBnXgPzEy1WoxZsFhEqUEArODDA4ARNuoBuZgoC+zY0A
Related Issues: