Skip to content

Interface: GuardHandlers<R> ​

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

Extended by ​

Type Parameters ​

Type ParameterDefault type
RSubjectRbac

Properties ​

PropertyTypeDescriptionDefined in
exposeRequirements?booleanInclude the required roles/permissions in the default error (required in its body). Default: false (like spatie's display_permission_in_exception).packages/trpc/src/guards.ts:71
onForbidden?GuardHandler<R>Called when the subject lacks access. Default: a TRPCError FORBIDDEN.packages/trpc/src/guards.ts:66
onUnauthenticated?GuardHandler<R>Called when there is no subject (ctx.rbac is null). Default: a TRPCError UNAUTHORIZED.packages/trpc/src/guards.ts:64

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