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
It's not even really clear to me what U means in this context. TS knows that the type of square is (x: number) => number, so it should be able to deduce that U in mapValues must be number.
does not specify a particular generic instantiation that correlates the type of the keys in the resulting type to the keys mapped by func because mapped types are not an inference sites.
There is nothing tying the generic instantiation of T for some keyof T to the result type.
I could be completely wrong 😓
I'm trying to model the underscore / lodash chain method and running into an odd issue.
TypeScript Version: 2.1.4
Code
Expected behavior:
v
should have type{a: number, b: number}
.Actual behavior:
v
has type{a: U, b: U}
.It's not even really clear to me what
U
means in this context. TS knows that the type ofsquare
is(x: number) => number
, so it should be able to deduce thatU
inmapValues
must benumber
.What's more, even if I make
U
explicit:then
v
still comes out with a type of{a: U, b: U}
.The text was updated successfully, but these errors were encountered: