refactor: make ApplicationCommandOptions optional

This commit is contained in:
Jacob Nguyen
2022-05-17 16:14:47 -05:00
parent c40b75d333
commit 5556b2aa0a
2 changed files with 4 additions and 12 deletions

View File

@@ -11,7 +11,6 @@ import type { Args } from '../../types/handler';
import type { CommandType } from '../sern';
import type { CommandPlugin, EventPlugin } from '../plugins/plugin';
import type Context from './context';
import { Base } from 'discord.js';
import type { PluginType } from '../plugins/plugin';
export interface BaseModule {
@@ -33,8 +32,7 @@ export type SlashCommand = Override<BaseModule, {
type: CommandType.Slash;
onEvent?: EventPlugin<CommandType.Slash>[]
plugins?: (CommandPlugin)[];
options: ApplicationCommandOptionData[] | [];
options?: ApplicationCommandOptionData[];
}>;
export type BothCommand = Override<BaseModule, {
@@ -42,7 +40,7 @@ export type BothCommand = Override<BaseModule, {
onEvent?: EventPlugin<CommandType.Both>[]
plugins?: (CommandPlugin)[]
alias?: string[];
options: ApplicationCommandOptionData[] | [];
options?: ApplicationCommandOptionData[];
}>;
export type ContextMenuUser = Override<BaseModule, {

View File

@@ -23,12 +23,6 @@ export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' |
//https://dev.to/vborodulin/ts-how-to-override-properties-with-type-intersection-554l
export type Override<T1, T2> = Omit<T1, keyof T2> & T2;
export type UnionToTuple<T> = T extends readonly [infer V, infer S]
? V extends V
? S extends S
? [V, S]
: [V]
: never
: never;
export type DefinitelyDefined<T, K> = T & Override<T, K>;
export type DefinitelyDefined<T, K> = T & Override<T, K>