Superstruct v0.16.0 Release Notes

Release Date: 2022-06-06 // almost 2 years ago
  • BREAKING

    Refinement functions are now called with valid, but potentially unrefined values. Previously the functions passed in to refine would always be called with sub-elements (eg. when using objects or arrays) that were completely valid and refined. However, this prevented collecting all the refinement errors from subelements in a validation in one go, which is common when validating forms. Note: this should not have any affect on almost all use cases, so you're safe to upgrade.


Previous changes from v0.15.0

  • 🛠 ###### FIXED

    Unions can now be coerced. Previously unions created a barrier in coercion such that structs nested inside unions would not have their coercion logic triggered, but this has been fixed.

    Assigning preserves type structs. Previously using the assign helper would implicitly convert type structs into object structs which wasn't expected and confusing, but this has been fixed.