Open atomanyih opened 2 years ago
Unless I'm missing something, it doesn't look like ow provides a way to do this out of the box.
Correct. .optional
indicates the value is optional, not the key.
I think this use-case should be supported, but I don't have a clear idea on how right now.
If we want to validate an object with optional parameters for a spread:
This doesn't work, as ow will assert
patchBody
aswhen really we want
Which makes a difference, as js treats undefined value and no key differently when spreading:
Unless I'm missing something, it doesn't look like
ow
provides a way to do this out of the box.In the mean time, I've worked around this by passing in an explicit type argument: