mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-01 00:20:07 +00:00
fix(stringOption): zod validation (#11532)
fix: zod validation Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1e88dcdc05
commit
e490a230a3
@@ -188,10 +188,19 @@ describe('Application Command toJSON() results', () => {
|
||||
type: ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
autocomplete: true,
|
||||
// TODO
|
||||
choices: [],
|
||||
});
|
||||
|
||||
// Starting with zod 4.4.0 (potentially lower), this usecase was broken prior to #11532
|
||||
// (i.e. choices not present at all with autocomplete: true)
|
||||
expect(getStringOption().setAutocomplete(true).toJSON()).toEqual<APIApplicationCommandStringOption>({
|
||||
name: 'owo',
|
||||
description: 'Testing 123',
|
||||
type: ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
autocomplete: true,
|
||||
});
|
||||
|
||||
expect(
|
||||
getStringOption().addChoices({ name: 'uwu', value: '1' }).toJSON(),
|
||||
).toEqual<APIApplicationCommandStringOption>({
|
||||
|
||||
@@ -39,7 +39,7 @@ const channelMixinOptionPredicate = z.object({
|
||||
|
||||
const autocompleteMixinOptionPredicate = z.object({
|
||||
autocomplete: z.literal(true),
|
||||
choices: z.union([z.never(), z.never().array(), z.undefined()]),
|
||||
choices: z.array(z.any()).length(0).optional(),
|
||||
});
|
||||
|
||||
const choiceValueStringPredicate = z.string().min(1).max(100);
|
||||
|
||||
Reference in New Issue
Block a user