DEV Community

Discussion on: TypeScript Tutorial - 'infer' keyword

Collapse
marzelin profile image
Marc Ziel

If you want the type for the first argument to a function, this code does the job:

type Arg1<T extends Function> = T extends (a1: infer A1) => any ? A1 : never;
Enter fullscreen mode Exit fullscreen mode