diff --git a/packages/builders/__tests__/interactions/ChatInputCommands/Options.test.ts b/packages/builders/__tests__/interactions/ChatInputCommands/Options.test.ts index 66fe99457..4cef822aa 100644 --- a/packages/builders/__tests__/interactions/ChatInputCommands/Options.test.ts +++ b/packages/builders/__tests__/interactions/ChatInputCommands/Options.test.ts @@ -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({ + name: 'owo', + description: 'Testing 123', + type: ApplicationCommandOptionType.String, + required: true, + autocomplete: true, + }); + expect( getStringOption().addChoices({ name: 'uwu', value: '1' }).toJSON(), ).toEqual({ diff --git a/packages/builders/src/interactions/commands/chatInput/Assertions.ts b/packages/builders/src/interactions/commands/chatInput/Assertions.ts index ebee3c295..68650119c 100644 --- a/packages/builders/src/interactions/commands/chatInput/Assertions.ts +++ b/packages/builders/src/interactions/commands/chatInput/Assertions.ts @@ -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);