I'm writing a function that accepts an array-like object and converts it to an array of numbers. However, TypeScript 3.9.7 does not infer the return type of Array.prototype.map.call() - it believes that it returns unknown[].
let input: string[] = ["1", "2", "3"];
// OK
let result1: number[] = input.map(str => Number(str));
// error TS2322: Type 'unknown[]' is not assignable to type 'number[]'
let result2: number[] = Array.prototype.map.call(input, str => Number(str));
I want TypeScript to infer the type of result2 from that of my callback (str => Number(str)). What can I do, apart from from using type assertions?
Edit: I am using the --strict compiler option.