Skip to content

Type Alias: GuardHandler<R> ​

ts
type GuardHandler<R> = (opts, context) => MaybePromise<Error>;

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

Returns the error to throw (or throws it), e.g. a TRPCError with another code. Anything that is not a TRPCError reaches the client as an INTERNAL_SERVER_ERROR.

Type Parameters ​

Type ParameterDefault type
RSubjectRbac

Parameters ​

ParameterType
optsGuardHandlerOptions<R>
contextGuardContext

Returns ​

MaybePromise<Error>

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