Type Alias: Guard<N, O, R, C>
ts
type Guard<N, O, R, C> = <A>(...args) => RbacMiddleware<R, C>;Defined in: packages/trpc/src/guards.ts:145
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. The middleware narrows ctx.rbac to R, and needs the context C.
Type Parameters
| Type Parameter | Default type |
|---|---|
N extends string | - |
O | - |
R | SubjectRbac |
C | RbacProcedureContext |
Type Parameters
| Type Parameter |
|---|
A extends readonly (GuardNames | O)[] |
Parameters
| Parameter | Type |
|---|---|
...args | A & RequirementArgs<A, N, O> |
Returns
RbacMiddleware<R, C>
