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
any inferred as type parameter even with --noImplicitAny #11311
a.ts(13,7): error TS2322: Type 'string[]' is not assignable to type 'number[]'.
Type 'string' is not assignable to type 'number'.
but x does not fail, because the generic parameter of map is inferred as any rather than string, even with --noImplicitAny turned on.
On another note, I'm not sure what's happening below: either the type parameter of identity is inferred as any or it's inferred as string & number and function bivariance wreaks its magic:
If e is an expression of a function type that contains exactly one generic call signature and no other members, and T is a function type with exactly one non-generic call signature and no other members, then any inferences made for type parameters referenced by the parameters of T's call signature are fixed, and e's type is changed to a function type with e's call signature instantiated in the context of T's call signature (section 3.11.6).
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
sergey-shandar commentedon Oct 11, 2016
Related issue #3038
mhegazy commentedon May 17, 2017
looks like a duplicate of #11152
mhegazy commentedon May 18, 2017
looks like the same issue as #9366
mhegazy commentedon May 24, 2017
The last example is technically as spec'ed. see 4.15.2 Type Argument Inference:
mhegazy commentedon Jun 8, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.