杜一袁老师讲解类型体操
type JSTypeMap = {
boolean: boolean;
bigint: bigint;
number: number;
string: string;
symbol: symbol;
undefined: undefined;
object: object;
function: (...args: any[]) => any;
};
type JSTypes = keyof JSTypeMap;
type GetType<T extends JSTypes[]> = {
[I in keyof T]: JSTypeMap[T[I]];
};
declare function addImpl<T extends JSTypes[]>(
...args: [...T, (...args: GetType<T>) => any]
): void;
addImpl("string", "bigint", "number", (a, b, c) => {});

浙公网安备 33010602011771号