-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Excess property checks (including the effects of spreads) #42
Comments
This is a good suggestion. I haven't implemented excess property checks or spreading into a object yet but when I get around to it I will have a look at catching this! |
I think this can be implemented here by raising a warning if ezno/checker/src/synthesis/expressions.rs Lines 1060 to 1069 in 24fb424
I also think because of this line here that it would work for spread expressions!! 😁 ezno/checker/src/synthesis/expressions.rs Line 1006 in 24fb424
|
took a look at implementing this. Looks like this approach would result in new excess property warnings in these test cases: In all three cases there is technically an excess property on the assignment, but curious to get your thoughts on whether that's actually what's desired here. |
Awesome! Thanks for taking a look @PatrickLaflamme Yes I understand that Objects Checks and Assignment will raise new warnings for excess properties which is wanted. Once this feature is added you can add a new bullet point to the markdown. Unsure about the Getters one though, I don’t an excess property there? If you have it working then you can put in a draft PR and I may be able to understand that one :) |
My mistake, it's actually Generic Extends, not Getters. Agree getters would be a concern. I'll get my PR opened up in the next day or two. Update: Just working through it with my employer to get permission to contribute. I have the permission, just need to get set up per their requirements. |
It would be nice to allow Ezno to have more guards and checks than Typescript. One of those is performing excess property checks on spreading (which Typescript doesn't do), link to the issue: microsoft/TypeScript#39998
I'm pretty sure there are other common footguns that Typescript has which would be nice to avoid here with a more strict typing. Great work!
The text was updated successfully, but these errors were encountered: