How could I extract the function's default type parameter to get something like this statement to compile?
const fails: string = "" as ReturnType<<T = string>() => T>;
CodePudding user response:
ReturnType<<T = string>() => T>
is unknown
and not string
:
type F = <T = string>() => T;
type X = ReturnType<F>;
// type X = unknown