diff --git a/src/core/functions.ts b/src/core/functions.ts index b0d9ab6..b9f241d 100644 --- a/src/core/functions.ts +++ b/src/core/functions.ts @@ -1,6 +1,5 @@ import { Err, Ok } from 'ts-results-es'; import type { Module, SernAutocompleteData, SernOptionsData } from '../types/core-modules'; -import type { AnyCommandPlugin, AnyEventPlugin, Plugin } from '../types/core-plugin'; import type { AnySelectMenuInteraction, ButtonInteraction, @@ -18,21 +17,17 @@ import type { Payload } from '../types/utility'; export const ok = () => Ok.EMPTY; export const err = () => Err.EMPTY; -export function partitionPlugins(arr: (AnyEventPlugin | AnyCommandPlugin)[] = []): [Plugin[], Plugin[]] { +export function partitionPlugins +(arr: Array<{ type: PluginType }> = []): [T[], V[]] { const controlPlugins = []; const initPlugins = []; - for (const el of arr) { switch (el.type) { - case PluginType.Control: - controlPlugins.push(el); - break; - case PluginType.Init: - initPlugins.push(el); - break; + case PluginType.Control: controlPlugins.push(el); break; + case PluginType.Init: initPlugins.push(el); break; } } - return [controlPlugins, initPlugins]; + return [controlPlugins, initPlugins] as [T[], V[]]; } /** diff --git a/src/types/dependencies.d.ts b/src/types/dependencies.d.ts index 123e37b..cf0fd9b 100644 --- a/src/types/dependencies.d.ts +++ b/src/types/dependencies.d.ts @@ -11,6 +11,3 @@ declare global { } -declare module './handler.js' { - declare const commands : Map -}