MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
711 stars 546 forks source link

fix: Add typed union validation #2534

Closed FrederikBolding closed 1 day ago

FrederikBolding commented 2 days ago

Adds a typedUnion utility which strictly validates members of the union based on a type field. This should reduce the noise when trying to parse through Superstruct validation failures resulting in validating large unions such as the JSX unions.

This doesn't solve the Superstruct union problem generally as we still have many unions of unions, but it might make the problem easier to solve.

codecov[bot] commented 1 day ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.95%. Comparing base (c5c2514) to head (b365cfa).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2534 +/- ## ========================================== + Coverage 93.94% 93.95% +0.01% ========================================== Files 456 456 Lines 9542 9568 +26 Branches 1458 1465 +7 ========================================== + Hits 8964 8990 +26 Misses 578 578 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.