We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
TypeScript Version: 4.0.2
Search Terms: generic constraint, extends infer
Code
type InferGenericConstraint<Fn> = Fn extends <T extends infer Constraint>(arg: T) => any ? Constraint : never; type GenericFunctionExample = <T extends number>(arg: T) => void; type InferredConstraint = InferGenericConstraint<GenericFunctionExample>;
Expected behavior:
InferredConstraint
number
infer
Actual behavior: InferredConstraint is never
never
Playground Link: https://tsplay.dev/gWoYlN
Related Issues: #1213
TypeScript Version: 4.0.2
Search Terms: generic constraint, extends infer
Code
Expected behavior:
InferredConstraintisnumber.inferdeclaration is disallowed within a generic constraint clause.Actual behavior:
InferredConstraintisneverPlayground Link: https://tsplay.dev/gWoYlN
Related Issues: #1213