I'm trying to use ReturnType to generate a type that depends on the return types of functions living on an object.
Here is the object:
const foo = {
bar: (): number => 1,
quux: (): string => 'a',
};
The desired resulting type is:
type FooLeaves = {
bar: number;
quux: string;
};
Is it possible to apply a ResultType to the values of the object in order to pull the return types out of the nested functions?
I guess I could invoke each value and take the type of that, but it seems hacky