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

[Feat] Adding the support for `setters` #94

Closed JulesGuesnon closed 6 months ago

JulesGuesnon commented 7 months ago

Description

This PR tries to handles #39 It's my first time touching to checker, so not sure if what I'm doing is exactly what is expected, so feel free to tell me if I'm mistaking somewhere

kaleidawave commented 7 months ago

This is a great implementation of TypeScript's behaviour for setters! Un/fortunately with Ezno we can do one better and actually evaluate the setter's side effects. Because other Ezno features rely of this behaviour existing it means that ALL side effects that can be observed, need to be.

It is my fault, I was a bit rushed in June and should have added more information to the issue. I have updated the message in #39 to describe the way to do in accordance with Ezno's type system. It reuses the calling logic which does the same parameter restriction checking in this first commit. Given the addition of CallingInput in #91 I think you should be confident with using those functions! Hopefully that clears it up.


Might seem a bit unnecessary, but things like array.length = 2 has the effect of deleting all number properties after 2 (need to double check that). So it can come in handy for catching a bunch of things TSC doesn't not just in user code, but in places that use platform APIs!

kaleidawave commented 6 months ago

Hey @JulesGuesnon, apologies that there wasn't information on the issue prior to the PR. Let me know if you still want to work on this based on the new information in the issue, or want any more pointers or me to start the implementation off etc.

JulesGuesnon commented 6 months ago

hey @kaleidawave really sorry for the delay, the end of this year has been a lot of changes in my personal life, so I've suddenly became quite busy. I still want to work on this, but not sure when I'll have the time tho. So if you want to do it or have the time to do so, please feel free to do it, otherwise I'll do it once I find some time

kaleidawave commented 6 months ago

Awesome, totally understand 👍 Closing this PR as I think it would be better for any second attempt to start afresh. Thanks for the attempt (and thanks for #91, have noticed the codebase feeling a lot less messy recently)