You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inferred type does not work for generic reduce function with when not used as a lambda #27708
I think in the past we've called this a design limitation and told people to invert their parameter order; but because of what we've been looking at recently w.r.t. proper unification, I'll mark this as a bug instead and ping Anders Hejlsberg (@ahejlsberg) for input. You think this is worth reconsidering?
I'd love to reconsider, but it is a hard problem. An inference scheme based on unification would presumably get this example right, but we know from experiments that unification surfaces hard problems for which we don't have an answer. See #24626 and other issues linked in that thread.
We could consider tweaks to the existing algorithm to defer inference from arguments that have a generic function type (similar to what we do for function expressions with contextually typed parameters), but that would only work for simple generic function arguments not for structures containing generic functions values. So, not sure that's worthwhile.
Activity
weswigham commentedon Oct 16, 2018
I think in the past we've called this a design limitation and told people to invert their parameter order; but because of what we've been looking at recently w.r.t. proper unification, I'll mark this as a bug instead and ping Anders Hejlsberg (@ahejlsberg) for input. You think this is worth reconsidering?
ahejlsberg commentedon Oct 17, 2018
I'd love to reconsider, but it is a hard problem. An inference scheme based on unification would presumably get this example right, but we know from experiments that unification surfaces hard problems for which we don't have an answer. See #24626 and other issues linked in that thread.
We could consider tweaks to the existing algorithm to defer inference from arguments that have a generic function type (similar to what we do for function expressions with contextually typed parameters), but that would only work for simple generic function arguments not for structures containing generic functions values. So, not sure that's worthwhile.
DanielRosenwasser commentedon Oct 25, 2018
Closing in favor of #9366.
typescript-bot commentedon Dec 13, 2018
This issue has been marked as a duplicate and has seen no activity in the last day. It has been closed for automatic house-keeping purposes.