The question is how to describe the return type of function bar which should be the result of execution of generic function fn.
function foo(fn<T>) /*return →*/ function bar<B> /*return →*/ call fn<B>()
Example:
function foo<T extends <X>(...args: any) => any>(fn: T) {
return function bar<B>(): ReturnType<typeof fn> /** 