Type arguments used in return types of argument functions are not correctly inferred when wrapped in objects #42379
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
Bug Report
π Search Terms
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
There is a function with a type argument
T
. It requires an object as an argument that has two properties:T
T
as an argument.If the first function requires any argument that must be inferred from the signature, TypeScript will fail to infer
T
(Case 1).This behavior does not occur when:
fixedParam
is explicitly typed (Case 2) or not used (Case 3).or
π Expected behavior
All
inferredParam
should be inferred asnumber
. This feature is useful when struggling with handling complex data structure in React.The text was updated successfully, but these errors were encountered: