ForbesLindesay / funtypes

Runtime validation for static types
MIT License
29 stars 4 forks source link

Extend Object #14

Open ForbesLindesay opened 4 years ago

ForbesLindesay commented 4 years ago

The behaviour of Intersect isn't always very intuitive when it comes to objects. The behaviour people want is often much closer to "spread". We should implement something similar to Zod's extend method: https://github.com/vriad/zod#extending-objects

Related request: https://github.com/pelotom/runtypes/issues/127

Also related is a request to be able to make a "partial" from an intersection: https://github.com/pelotom/runtypes/issues/52

MicahZoltu commented 1 year ago

The linked https://github.com/pelotom/runtypes/issues/52 has a recommended workaround of Partial(Info.fields). Unfortunately, it doesn't appear that Funtypes exposes a fields property so this doesn't work. Is there some other way to make this work today in Funtypes?