Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/ast.generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function convertArray(arrayArgument, previousInstance = yup) {

// Handle the case when we've got an array of empty elements
if (convertedArguments instanceof Array) {
if (convertedArguments.filter(i => i).length < 1) {
if (convertedArguments.filter(i => i !== undefined).length < 1) {
return gotFunc();
}

Expand Down
9 changes: 9 additions & 0 deletions source/tests/converter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ const numberTests = [
failure: [1, 2, 3, 4, 501, 502, 503],
},
},
{
name: 'Converts simple type with falsy args',
input: [['yup.number'], ['yup.required'], ['yup.min', 0]],
validates: {
// prettier-no-wrap
success: [0, 50],
failure: [-50],
},
},
];

const stringTests = [
Expand Down