-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
feat(vanilla): Support class fields (defineProperty) #760
Conversation
Support ES2022 class fields created with Object.defineProperty() semantics. When a class field is created on a proxy object that does not have the field yet, or has a data field of the same name, treat it like a [[set]] trap.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 577e63e:
|
Size Change: +1.33 kB (+2%) Total Size: 58.6 kB
ℹ️ View Unchanged
|
I think it's good. Thanks for the suggestion. I would like to refactor to make "treat it like a [[set]] trap" clear. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there are pitfalls, but this should be harmless for normal (plain objects) usage, except for the bundle size increase.
While investigating #764, I learned that the Perhaps I was too hasty in reusing the |
would it be possible to reproduce it in tests? |
)" This reverts commit c0bda5a. Due to what I presume is a bug in the Hermes engine, React Native projects cannot use Valtio 1.11.0. Let's revert pmndrs#760 to support existing React Native users.
…mndrs#760)" (pmndrs#766)" This reverts commit 6eac2fc.
Related Issues or Discussions
Fixes #759 (the feature request at the end)
Summary
Adds support for ES2022 class fields created with
Object.defineProperty()
semantics. When a configurable, enumerable, and writable (CEW) own property (usually a class field) is created on a proxy object that does not have the property, or has a CEW own property of the same name, treat it like a [[set]] trap.Check List
yarn run prettier
for formatting code and docs