type AnyFunction = (...args: any[]) => any;
type ReturnType‹T extends AnyFunction› = T extends (...args: any[]) => infer R ? R : any;