Skip to content

Type Alias: ScopedGuard<T, G, K, O, C> ​

ts
type ScopedGuard<T, G, K, O, C> = <A>(...args) => RbacMiddleware<GuardSubject<T, G>, C>;

Defined in: packages/trpc/src/guards.ts:173

A guard of createGuards<T, G>() when T has per-guard names (RbacTypeConfig['guards']): like Guard, but the names are those of the guard the call checks in, its { guard } option or else G (the guard of the subject). requirePermission('orders.read', { guard: 'api' }) takes the api names.

Type Parameters ​

Type ParameterDefault type
T extends RbacTypeConfig-
G extends string-
K extends GuardKind-
O-
CRbacProcedureContext

Type Parameters ​

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

Parameters ​

ParameterType
...argsA & GuardRequirementArgs<A, T, K, G, O>

Returns ​

RbacMiddleware<GuardSubject<T, G>, C>

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