-
Notifications
You must be signed in to change notification settings - Fork 12.8k
No errors on array initialization if any element is of any type #46190
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
When you are using If you want to mark variable that can keep some value but you don't know what it is exact - use |
There was a mistake in my demo code/playground. I've updated it. I understand if This can be especially hard to find if the |
Duplicate of #19541. Used search terms: |
Bug Report
π Search Terms
π Version & Regression Information
3.9.7 and beyond
β― Playground Link
https://www.typescriptlang.org/play?ts=3.9.7#code/MYewdgzgLgBBIFsCmYCuCBGSBOAuGamOMAvDAIwDcAUKJLPMlABYCWYA5kgDYRL4BDMAE9SFGnWgxg+aNnYcA2gF0xixinRZsAGjiIkLBTz7LKQA
π» Code
π Actual behavior
No errors reported.
π Expected behavior
Error reported on the array initialization, on line 3, on the use of
somenumber
in a string array .Side note
If this is expected behavior when any item is any, is there a way to have the typescript lint report this?
It seems odd that the initialization line reports no error or warning at all, since there's a specific type declared on that line.
The text was updated successfully, but these errors were encountered: