The infer Keyword
Inside a conditional type's extends clause, infer R declares a local type variable that pattern-matches part of the checked type — a return type, an array element, a tuple tail — bindable only in the true branch. It is destructuring for types, and the mechanism behind ReturnType, Parameters, and Awaited.
This Concept is waiting for its first lesson!
Inside a conditional type's extends clause, infer R declares a local type variable that pattern-matches part of the checked type — a return type, an array element, a tuple tail — bindable only in the true branch. It is destructuring for types, and the mechanism behind ReturnType, Parameters, and Awaited.
Are you a teacher? Sign in to start contributing.
Sign In