Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-mitchell committed Mar 5, 2024
1 parent 4aa9ccd commit a0a8558
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/options.ts
Expand Up @@ -43,7 +43,7 @@ const validateOptions = (options: ParsedOptions): void => {
},
},
defaultNotInChoices: {
filter: ([, flag]) => flag.default !== undefined && Array.isArray(flag.choices) && ![flag.default].flat().every(value => flag.choices!.includes(value as never)), // TODO: never?
filter: ([, flag]) => flag.default !== undefined && Array.isArray(flag.choices) && ![flag.default].flat().every(value => flag.choices!.includes(value as never)),
message: flagKeys => `Each value of the option \`default\` must exist within the option \`choices\`. Invalid flags: ${joinFlagKeys(flagKeys)}`,
},
},
Expand Down
2 changes: 1 addition & 1 deletion source/validate.ts
Expand Up @@ -39,7 +39,7 @@ const validateChoicesByFlag = (flagKey: string, flagValue: AnyFlag, receivedInpu
}

if (Array.isArray(receivedInput)) {
const unknownValues = receivedInput.filter(index => !choices.includes(index as never)); // TODO: never?
const unknownValues = receivedInput.filter(input => !choices.includes(input as never));

if (unknownValues.length > 0) {
const valuesText = unknownValues.length > 1 ? 'values' : 'value';
Expand Down

0 comments on commit a0a8558

Please sign in to comment.