typescript error

Type 'Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">' is missing the following properties from type 'SlashCommandBuilder': addSubcommandGroup, addSubcommand, _sharedAddOptionMethodts(2739)
handler.d.ts(10, 3): The expected type comes from property 'command' which is declared here on type 'SlashCommand'
Type 'Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">' is missing the following properties from type 'SlashCommandBuilder': addSubcommandGroup, addSubcommand, _sharedAddOptionMethodts(2739)
handler.d.ts(10, 3): The expected type comes from property 'command' which is declared here on type 'SlashCommand'
import {
AutocompleteInteraction,
ChatInputCommandInteraction,
Client,
ModalSubmitInteraction,
SlashCommandBuilder,
} from "discord.js";
export interface SlashCommand {
command: SlashCommandBuilder;
execute: (interaction: ChatInputCommandInteraction) => void;
autocomplete?: (interaction: AutocompleteInteraction) => void;
modal?: (interaction: ModalSubmitInteraction<CacheType>) => void;
}
import {
AutocompleteInteraction,
ChatInputCommandInteraction,
Client,
ModalSubmitInteraction,
SlashCommandBuilder,
} from "discord.js";
export interface SlashCommand {
command: SlashCommandBuilder;
execute: (interaction: ChatInputCommandInteraction) => void;
autocomplete?: (interaction: AutocompleteInteraction) => void;
modal?: (interaction: ModalSubmitInteraction<CacheType>) => void;
}
4 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Kinect3000
Kinect30004mo ago
Pick the methods that you want from the builder Or use whatever type the to json method returns
!هـ.ـψ
!هـ.ـψ4mo ago
like that?
type CustomSlashCommandBuilder = Omit<
SlashCommandBuilder,
| "addBooleanOption"
| "addUserOption"
| "addChannelOption"
| "addRoleOption"
| "addAttachmentOption"
| "addMentionableOption"
| "addStringOption"
| "addIntegerOption"
| "addNumberOption"
| "addSubcommand"
| "addSubcommandGroup"
>;
export interface SlashCommand {
command: CustomSlashCommandBuilder;
execute: (interaction: ChatInputCommandInteraction) => void;
autocomplete?: (interaction: AutocompleteInteraction) => void;
modal?: (interaction: ModalSubmitInteraction<CacheType>) => void;
}
type CustomSlashCommandBuilder = Omit<
SlashCommandBuilder,
| "addBooleanOption"
| "addUserOption"
| "addChannelOption"
| "addRoleOption"
| "addAttachmentOption"
| "addMentionableOption"
| "addStringOption"
| "addIntegerOption"
| "addNumberOption"
| "addSubcommand"
| "addSubcommandGroup"
>;
export interface SlashCommand {
command: CustomSlashCommandBuilder;
execute: (interaction: ChatInputCommandInteraction) => void;
autocomplete?: (interaction: AutocompleteInteraction) => void;
modal?: (interaction: ModalSubmitInteraction<CacheType>) => void;
}
Kinect3000
Kinect30004mo ago
I would’ve just Pick<SlashCommandBuilder, "toJSON">