UNPKG

298 BPlain TextView Raw
1/**
2 * Extracts the types of a given function's arguments
3 *
4 * Example:
5 * type MyFunction = (arg1: string, arg2: number) => void;
6 * type Args = Arguments<MyFunction>; // Args is [string, number]
7 *
8 */
9export type Arguments<F extends Function> = F extends (...args: infer A) => any ? A : never;