TS Error

export interface Command {
  name?: string; // Command names are taken from file names
  description: string;
  type: ApplicationCommandType;
  defaultPermissions?: PermissionResolvable;
  options?: ApplicationCommandOptionData[];
  run: (interaction: ECICInteraction) => void;
  autocomplete?: (interaction: AutocompleteInteraction) => void;
}

public appCommands: Command[] = [];

public refreshCommands(): Promise<Collection<string, ApplicationCommand<{
    guild: GuildResolvable;
  }>>> {
    return this.application.commands.set(this.appCommands.map(cmdObj => {
      const command: ApplicationCommandDataResolvable = {
        name: cmdObj.name as string,
        type: cmdObj.type, // Type 'ApplicationCommandType' is not assignable to type 'ApplicationCommandType.ChatInput'.
        defaultMemberPermissions: cmdObj.defaultPermissions || null,
        dmPermission: false
      };

      if(cmdObj.type === ApplicationCommandType.ChatInput) {
        command.description = cmdObj.description; // Property 'description' does not exist on type 'UserApplicationCommandData'.
        command.options = cmdObj.options; // Property 'options' does not exist on type 'UserApplicationCommandData'.
      }

      return command;
    }));
  }
Was this page helpful?