ianstormtaylor / superstruct

A simple and composable way to validate data in JavaScript (and TypeScript).
https://docs.superstructjs.org
MIT License
7.01k stars 224 forks source link

mask does not work anymore. #1265

Open Ayora29 opened 3 months ago

Ayora29 commented 3 months ago

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 commented 3 months ago

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:

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 commented 3 months ago

@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.