You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.
Typewiz seems to change objects by replacing their fields with property getters and setters—this makes sense, since it needs to track the types of the values being written.
However, wherever one uses something like Object.assign(), the spread operator, lodash.extend, etc., things seem to break—these functions aren't able to enumerate the fields (since they aren't real fields).
Do you have any suggestions on dealing with this? Thanks!
The text was updated successfully, but these errors were encountered:
I spent some time thinking about this, and I think using Proxy objects (along with some decorators) could do the trick. I prototyped something quick here, just to check feasibility:
(check out the console output when running this example)
It seems like this would do the trick for the most part, except for tracking properties that are assigned value during the construction of the object. Can you please check if this approach would work better with the functions you mentioned?
Currently, typewiz replaces properties with setter/getters, so we can instrument the setters. I was thinking about using Proxy object, so this is more transparent to the user. However, it seems like this will miss everything that happens inside the constructor, unless there is some creative way to proxy the this within the constructor too?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Typewiz seems to change objects by replacing their fields with property getters and setters—this makes sense, since it needs to track the types of the values being written.
However, wherever one uses something like Object.assign(), the spread operator, lodash.extend, etc., things seem to break—these functions aren't able to enumerate the fields (since they aren't real fields).
Do you have any suggestions on dealing with this? Thanks!
The text was updated successfully, but these errors were encountered: