The `infer` Keyword
The lesson goes through some of the remaining built-in conditional types and introduces the `infer` keyword.
We'll cover the following...
We'll cover the following...
Parameters
The Parameters type takes a function type and returns a tuple type representing types of all parameters of the function. Sounds magical, doesn’t it?
Let’s break down this definition. First, the Parameters type has a type argument constraint that says that T must be a function type ((...args: any) => any). Next, inside the conditional expression we say that T extends (...args: infer P) => any. ...