Skip to content

Type Alias: CommandDecorator<G>

Command decorator.

A function that wraps a command runner to add or modify its behavior.

Since

v0.27.0

Signature

ts
export type CommandDecorator<G extends GunshiParamsConstraint = DefaultGunshiParams> = (baseRunner: (ctx: Readonly<CommandContext<G>>) => Awaitable<string | void>) => (ctx: Readonly<CommandContext<G>>) => Awaitable<string | void>

Type Parameters

NameDescription
G extends GunshiParamsConstraint = DefaultGunshiParamsA type extending GunshiParams to specify the shape of command context.

Parameters

NameTypeDescription
baseRunner(ctx: Readonly<CommandContext<G>>) => Awaitable<string | void>The base command runner to decorate

Returns

(ctx: Readonly<CommandContext<G>>) => Awaitable<string | void> — The decorated command runner

Released under the MIT License.