-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[] is regard wrong as never[] when strictNullChecks is true #13140
Comments
An empty array without a type annotation can not be inferred to have any type. If Add a type annotation or an intializer to avoid getting a |
Why can't we use control-flow analysis so that users get the "smart" behavior that they get with |
cause |
What I mean is: can we change the behavior so that users get similar behavior as if they did enable |
That was discussed in #12359. and the conclusion was not to do that. |
Since I don't see it recorded in the meeting notes, do you recall the justification? My understanding is that the reason we didn't do it outside of |
The two bugs listed were the reason. Being a breaking change and causing perf regressions. |
TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)
2.1.4
Code
test.ts
tsconfig.json
Expected behavior:
Compile successfully.
Actual behavior:
Maybe
output
should be treated asany[]
?It would compile successfully if
strictNullChecks: false
The text was updated successfully, but these errors were encountered: