const ow = require('ow').default;
ow({ foo: 'bar', bar: undefined }, ow.object.exactShape({
foo: ow.string,
}));
Throws:
ArgumentError: Did not expect property `bar` to exist, got `undefined` in object
...
validationErrors: Map(1) {
'object' => Set(1) {
'Did not expect property `bar` to exist, got `undefined` in object'
}
}
Even though I understand that there's a difference between those two objects:
const obj1 = {};
const obj2 = { bar: undefined };
I believe that for the purposes of argument validation they are the same and the error message "Did not expect property bar
to exist, got undefined
in object" does not make sense to me. I would expect the original code to not throw.
If accepted as a bug, I can do the PR to fix it. Thanks.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too