-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Excess property check misses an error with union+string indexer #20060
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
The excess property check is satisfied by Structural assignability is satisfied by The basic problem is that excess property checks happen before structural assignability finds the "best match" of the union; it uses a faster, heuristic check that doesn't perfectly match the exhaustive search used by structural assignability. We could try moving excess property checking to the end of structuredTypeRelatedTo (or propertiesRelatedTo?) — object literals are guaranteed to reach this point, and they are the only things that are marked fresh right now. The code would be simpler because it wouldn't have to deal with unions. However, the performance gains from #16363 would very likely disappear. |
It seems that it had been solved in version 3.8. |
@axiac thanks! |
Expected behavior:
Error "foo is an excess property"
Actual behavior:
No error.
The text was updated successfully, but these errors were encountered: