-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
any
inferred as type parameter even with --noImplicitAny
#11311
Comments
Related issue #3038 |
looks like a duplicate of #11152 |
Here's a simpler example: declare function f<T>(x: T): T;
declare function f<T>(x: T, y: number): T;
const a: string[] = ["a", "b"];
const b = a.map(f); Even in the absence of a type annotation on |
looks like the same issue as #9366 |
The last example is technically as spec'ed. see 4.15.2 Type Argument Inference:
|
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
TypeScript Version: nightly (2.1.0-dev.20161002)
Code
Expected behavior:
Both
x
andy
are compile errors.Actual behavior:
y
fails with:but
x
does not fail, because the generic parameter ofmap
is inferred asany
rather thanstring
, even with--noImplicitAny
turned on.On another note, I'm not sure what's happening below: either the type parameter of
identity
is inferred asany
or it's inferred asstring & number
and function bivariance wreaks its magic:The text was updated successfully, but these errors were encountered: