[Typescript] Infer first argument of a function
type OneArgFn<A = any> = (firstArg: A, ..._args: any[]) => void
type GetFirstArg<T>
= T extends OneArgFn<infer R>
? R
: never;
// Test case
function foo(x: string, y: number) {return null}
// ^?
type t1 = GetFirstArg<typeof foo>
// ^? string