Skip to content
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

Allow frozen objects/arrays to be coerced #1151

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arturmuller
Copy link
Collaborator

The Bug

The issue was the mutation of the input object/array while coercing entries inside the run util -- combined with a missing custom coercer which would clone its input (exactly as @gwisp2 suggested in #1096).

Apart from record, tuple was also affected by the same potential issue.

PR Changes

  1. Added coercer that clones its input to record and tuple.
  2. Added tests with frozen objects for all structs which could potentially be affected (object/array based and include entries).

Resolves #1096

arturmuller added a commit to superstructjs/superstruct that referenced this pull request Nov 3, 2023
* Update tuple coercer
* Update record coercer
* Add frozen objects/arrays tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runtime error when using create() on superstruct.record with a frozen object
1 participant