Meta props defintion:
interface ITableProps<T> {
onChange?: (
pagination: number;
filters: Record<string, T>;
section: string[];
) => void;
}
Expect: I want to combine the parameters in this function into the interface type of key value, like this:
type ExtractFuncParameters<T> = {
pagination: number;
filters: Record<string, T>;
section: string[];
}
But now, I can only get the various types of parameters in the function, I can't get his name, this is my implement:
type OnChangeParameters = Parameters<ITableProps<unknown>['onChange']>
type TupleToUnion<T> = T extends Array<infer P> ? P : never;
// number | Record<string, unknown> | string[];
type OnChangeParametersToUnion = TupleToUnion<OnChangeParameters>
// what should I do ?