Skip to content

Type Alias: ValidationErrorsDecorator<G> ​

Validation errors renderer decorator type. A function that wraps a validation errors renderer to add or modify its behavior.

Since ​

v0.27.0

Signature ​

ts
export type ValidationErrorsDecorator<G extends GunshiParamsConstraint = DefaultGunshiParams> = (baseRenderer: (ctx: Readonly<CommandContext<G>>, error: AggregateError) => Promise<string>, ctx: Readonly<CommandContext<G>>, error: AggregateError) => Promise<string>

Type Parameters ​

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

Parameters ​

NameTypeDescription
baseRenderer(ctx: Readonly<CommandContext<G>>, error: AggregateError) => Promise<string>The base validation errors renderer function to decorate
ctxReadonly<CommandContext<G>>The command context
errorAggregateErrorThe aggregate error containing validation errors

Returns ​

Promise<string> — The decorated result

Released under the MIT License.