diff --git a/packages/builders/__tests__/types.test.ts b/packages/builders/__tests__/types.test.ts new file mode 100644 index 000000000..dfd6abef3 --- /dev/null +++ b/packages/builders/__tests__/types.test.ts @@ -0,0 +1,17 @@ +import { expectTypeOf } from 'vitest'; +import { SlashCommandBuilder, SlashCommandStringOption, SlashCommandSubcommandBuilder } from '../src/index.js'; + +const getBuilder = () => new SlashCommandBuilder(); +const getStringOption = () => new SlashCommandStringOption().setName('owo').setDescription('Testing 123'); +const getSubcommand = () => new SlashCommandSubcommandBuilder().setName('owo').setDescription('Testing 123'); + +type BuilderPropsOnly = Pick< + Type, + keyof { + [Key in keyof Type as Type[Key] extends (...args: any) => any ? never : Key]: any; + } +>; + +expectTypeOf(getBuilder().addStringOption(getStringOption())).toMatchTypeOf(); + +expectTypeOf(getBuilder().addSubcommand(getSubcommand())).toMatchTypeOf(); diff --git a/packages/builders/src/interactions/slashCommands/mixins/SharedSlashCommand.ts b/packages/builders/src/interactions/slashCommands/mixins/SharedSlashCommand.ts index 4d321073c..9e178f82f 100644 --- a/packages/builders/src/interactions/slashCommands/mixins/SharedSlashCommand.ts +++ b/packages/builders/src/interactions/slashCommands/mixins/SharedSlashCommand.ts @@ -27,6 +27,17 @@ export class SharedSlashCommand { public readonly options: ToAPIApplicationCommandOptions[] = []; + /** + * @deprecated Use {@link SharedSlashCommand.setDefaultMemberPermissions} or {@link SharedSlashCommand.setDMPermission} instead. + */ + public readonly default_permission: boolean | undefined = undefined; + + public readonly default_member_permissions: Permissions | null | undefined = undefined; + + public readonly dm_permission: boolean | undefined = undefined; + + public readonly nsfw: boolean | undefined = undefined; + /** * Sets whether the command is enabled by default when the application is added to a guild. * diff --git a/vitest.config.ts b/vitest.config.ts index c6e4f62c4..60e469dda 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,6 +4,10 @@ export default defineConfig({ test: { exclude: ['**/node_modules', '**/dist', '.idea', '.git', '.cache'], passWithNoTests: true, + typecheck: { + enabled: true, + include: ["**/__tests__/types.test.ts"] + }, coverage: { enabled: true, all: true,