Can the variable baz be dynamically assigned the string type?
type sampleType = () => ReturnType<sampleType>; // Want to return the type of any function I pass (Eg. ReturnType<typeof foo>)
interface ISampleInterface {
baz: sampleType;
}
function foo(): string {
return 'AAAAAAA';
}
const foobaz = {
baz: foo,
} as ISampleInterface;
const qux = foobaz.baz();
qux; // Qux has type "any"