Skip to content

Type Alias: Guard<N, O> ​

ts
type Guard<N, O> = <A>(...args) => GuardHook;

Defined in: packages/fastify/src/guards.ts:161

A guard typed with the names N it accepts and its options O: (...names, options?). Every name (each part of a 'a|b' list, each array item) must be one of N; with N = string, any name is. A call without names, or with options that are not the last argument, is a type error.

Type Parameters ​

Type Parameter
N extends string
O

Type Parameters ​

Type Parameter
A extends readonly (GuardNames | O)[]

Parameters ​

ParameterType
...argsA & RequirementArgs<A, N, O>

Returns ​

GuardHook

Released under the MIT License. Inspired by spatie/laravel-permission.