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
But is it necessary? If key was properly inferred then we would have better typing (no any type when indexing) with no unnecessary additional type annotation.
The text was updated successfully, but these errors were encountered:
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
I noticed that in generic functions when we use for in loop on object of type
T
then iterator element is of typekeyof T
But for normal code on not generic object types we always get
string
as type ofkey
variable:And in this example we'll get
any
as type ofvalue
and error when we'll usenoImplicitAny
Suggestion:
Can't we infer the type of
key
askeyof typeof example
which is"propString" | "propNumber"
. It looks more consistent with generics behavior.Of couse right now we can do workaround like this:
But is it necessary? If key was properly inferred then we would have better typing (no
any
type when indexing) with no unnecessary additional type annotation.The text was updated successfully, but these errors were encountered: