Function comparison in TS is, perhaps, unexpectedly complicated (or at least unintuitive), and the handbook has a section specifically about this.
In the example code you've shown, you've run into the issue of function parameter bivariance. To work around this: instead of comparing the entire function, you can compare its parameters and return type in isolation to those of the other function in question. Consider the following:
In a comment to your question, Tobias S. mentioned another answer which explains different types of variance in more detail.
TS Playground
type Fn<Params extends readonly any[] = readonly any[], Result = any> =
(...params: Params) => Result;
type FnAExtendsFnB<FnA extends Fn, FnB extends Fn> =
Parameters<FnA> extends Parameters<FnB>
? ReturnType<FnA> extends ReturnType<FnB>
? true
: false
: false;
type AExtendsB<A, B> = A extends B ? true : false;
// The function from your question:
type Foo = Fn<[a: number, b: number], number>;
type UnknownParamsUnknownResult = Fn<unknown[], unknown>;
type AnyParamsUnknownResult = Fn<any[], unknown>;
declare const T1: AExtendsB<Foo, UnknownParamsUnknownResult>; // false
declare const T2: AExtendsB<Foo, AnyParamsUnknownResult>; // true
declare const T3: FnAExtendsFnB<Foo, UnknownParamsUnknownResult>; // true
declare const T4: FnAExtendsFnB<Foo, UnknownParamsUnknownResult>; // true