Given an interface like this:
interface IDelegates {
delegateOne: (name: string, age: number) => string;
delegateTwo: (date: Date) => number;
}
How to define a method that takes in a func of the correct delegate type, based on the interface property name?
I can get a type with just the property I want using Pick<IDelegates, 'delegateOne'> which returns a type:
{
delegateOne: (name: string, age: number) => string;
}
But I can't then figure out if there is a way to do Parameters<Pick<IDelegates, 'delegateOne'>>
I get why this doesn't work, but thinging there might be a way? Basically I'd need PickOne or something, to return just the property 'delegateOne', rather than a type containing the property.