Skip to content

Commit 49b2ba3

Browse files
committed
allow empty arrays as default values for variadic arguments
1 parent 590b1b1 commit 49b2ba3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

v-next/core/src/internal/arguments.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function isArgumentValueValid(
3636
const validator = argumentTypeValidators[type];
3737

3838
if (isVariadic) {
39-
return Array.isArray(value) && value.length > 0 && value.every(validator);
39+
return Array.isArray(value) && value.every(validator);
4040
}
4141

4242
return validator(value);

v-next/core/test/internal/arguments.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe("Arguments", () => {
7979
isArgumentValueValid(ArgumentType.BIGINT, [123n, BigInt(123)], true),
8080
true,
8181
);
82-
assert.equal(isArgumentValueValid(ArgumentType.STRING, [], true), false);
82+
assert.equal(isArgumentValueValid(ArgumentType.STRING, [], true), true);
8383
assert.equal(
8484
isArgumentValueValid(ArgumentType.STRING, ["foo", 123], true),
8585
false,

0 commit comments

Comments
 (0)