-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Array Destructuring Inference Is Incorrect #36635
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
We'd do this at the same time as #13778, so marking as duplicate |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
@RyanCavanaugh Is it possible to re-open this issue and consider it separate from #13778 ? I believe 13778 has gone off to a side where the issue with array destructuring having inaccurate types may be getting delayed to be fixed because of other users wanting to try and have this in loops as well(which i disagree with). I think the behavior in loops, .map and such are fine as is. Array destructuring is the issue imo. I just prevented this issue in a deployment that would have basically broken about 50% of my project only because I was aware of this bug. Could have potentially effected a ton of users. |
Search Terms
array destructuring, array destructuring inference
Suggestion
When you use array destructuring the type is inferred incorrectly. I hope something can be changed to enforce proper type inference when using this. In my code, TS has helped clean and prevent a lot of mistakes. The only mistakes that I repeatedly find being made either by me or others in my project are always related to this. Time and time again I have had these errors happen in runtime making the benefits of Typescript lost. An option to enforce this would be amazing, please. (Especially if it is just included inside the
strict
option.)Use Cases
Examples
Proper Way:
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: