kaleidawave / ezno

A JavaScript compiler and TypeScript checker written in Rust with a focus on static analysis and runtime performance
https://kaleidawave.github.io/posts/introducing-ezno/
MIT License
2.3k stars 42 forks source link

implement excess params checks as described in #42 #139

Closed PatrickLaflamme closed 1 month ago

PatrickLaflamme commented 1 month ago

Implements excess params checks as described in #42. Updates to the various tests are included. Two new tests are also added to specification.md.

kaleidawave commented 1 month ago

Awesome. Same as other PR looks good to merge (just needs one pedantic linter fix). Will merge when back!

kaleidawave commented 1 month ago

Another great PR! Have just done a few tweaks to the tests

Also changed the message to add quotations around the property key as Excess property property was was provided, but is not a property of type T looked funny 😅

kaleidawave commented 1 month ago

Thanks for adding this! It is cool to see my expected property feature allows this to catch issues that TypeScript doesn't catch. Also good that it is a warning as it doesn't break any code. I don't know why the TypeScript team treats it as an error?

Going to showcase this addition in an upcoming blog post. Let me know if you want to include anything in that.

Also if you have any suggestions to improve the codebase, things that are confusing or not documented well let me know as I am going to do some refactoring soon!

PatrickLaflamme commented 1 month ago

Will be diving into it again this weekend. Going to take a stab at the Proxy support ticket.

kaleidawave commented 1 month ago

Hey, added some additional tests for this: https://github.com/kaleidawave/ezno/blob/main/checker/specification/specification.md#excess-property. Because of the expected type / forward inference thing this also works for returns.

(also changed the excess property lookup to use the existing property lookup, so should be a little faster).