ianstormtaylor / superstruct

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

Unexpected behaviour when combining `assign` + `refine` #1188

Open john-rodewald opened 1 year ago

john-rodewald commented 1 year ago

I have an object-shaped struct that was created with refine and a custom validation handler. I want to extend this struct with additional fields. If I use assign, my validation handler seems to be skipped. Is this intended behaviour? If so, what is the proper way to do this?

I've created a minimal example to illustrate the issue I'm facing.

https://codesandbox.io/s/loving-sunset-zdvs6r?file=/index.js

dearlordylord commented 2 months ago

I can reproduce this issue with v2.0 too