mirror of
https://github.com/sern-handler/handler
synced 2026-06-19 22:32:14 +00:00
refactor: make ApplicationCommandOptions optional
This commit is contained in:
@@ -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, {
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user