-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Implicit any
s with Map
even if noImplicitAny
is enabled
#35259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Duplicate #33279 Search term: |
@RyanCavanaugh So is this actually expected behaviour? This seems like a big hole in TypeScript's typing. |
I've also been burned by this kind of thing before; usually when RXJS pipe inference gets widened to Even if noImplicitAny is working as expected, A stricter compile option that would force assertions before passing or assigning something with an inferred This example with With an option like I am imagining, in the OP's example there would be no error in creating the Map or setting the values, but it would be an error to return it as |
Another source of these unexpected "any" bugs is when a conditional type resolves to "any", often unexpectedly. I have looked into things like dtslint to try and catch these, but they have been sort of a square peg / round hole situation. If there are any alternatives to a compiler option that could alert me when |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: vNightly in Playground
Search Terms:
inferred any, implicit any, unsound
Code
Expected behavior:
I expected this to throw an error if
noImplicitAny
is enabled.For what it's worth, Flow handles this correctly.
Actual behavior:
No errors
Playground link
Related Issues:
No
The text was updated successfully, but these errors were encountered: