Closed
Description
TypeScript Version: 4.0.2
Code
interface Foo {
bla: string;
}
declare function map<T, R>(value: T[], transform: (t: T) => R): R[];
declare const foos: Foo[];
declare function call<Fn extends (...args: any[]) => any>(
fn: Fn,
...args: Parameters<Fn>
): ReturnType<Fn>;
const a = call(map, foos, (foo: Foo) => foo.bla);
Expected behavior:
I expect this to give no compile errors.
Actual behavior:
Argument of type '(foo: Foo) => string' is not assignable to parameter of type '(t: unknown) => unknown'. Types of parameters 'foo' and 't' are incompatible. Type 'unknown' is not assignable to type 'Foo'
Playground Link:
Playground