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

mask does not work anymore. #1265

Open
Ayora29 opened this issue Jul 22, 2024 · 3 comments
Open

mask does not work anymore. #1265

Ayora29 opened this issue Jul 22, 2024 · 3 comments

Comments

@Ayora29
Copy link

Ayora29 commented Jul 22, 2024

The mask utility does not work in the 2.0.2 version.

If used with "type" struct it does nothing. If used with "object" struct it throws a StructError for any unknown field.

I had rollback to 1.0.4 version and it works as intended.

@yeoffrey
Copy link
Contributor

yeoffrey commented Jul 22, 2024

Hi @Ayora29, thank you for the report. Could you provide some more information? Mask had breaking changes documented in v2.0.0. Did downgrading from v2.0.2 to v2.0.1 and v2.0.0 also not work, or was v1.0.4 the first version where it behaved as expected?

Please link an example so we can help debug or explain some functionality, otherwise we can't do much at all. We have many issues to work through in this project and its an entirely volunteer based team, so it would save us (and you) time to write some more information along with your report. This would include:

  • A reproducible example with code so we can debug.
  • A specific minimum version where this bug doesn't exist.

Also noted here in the documentation:

Note that when mask is used with type — given that type signals to the core that an object might have arbitrary additional properties — unknown properties will be retained in the returned value.

@arturmuller
Copy link
Collaborator

@Ayora29 it would be great if you could supply a minimal repro as @yeoffrey mentioned. If there indeed is an actual issue I would love it get to the bottom of this.

For our tested cases and in all of the code I have access to mask seems to be working as intended. So — without a repro we won't be able to address whatever issue you might be running into.

@jcalfee
Copy link

jcalfee commented Dec 1, 2024

Are these StructError(s) from mask expected?

  expect(()=> string().mask(undefined)).throws(/Expected a string, but received: undefined/)
  expect(()=> object({ f1: string() }).mask({})).throws(/Expected a string, but received: undefined/)

"superstruct": "^1.0.4"

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

No branches or pull requests

4 participants