Skip to content

Type Alias: Guard<N, O, R> ​

ts
type Guard<N, O, R> = <X>(request, ...rest) => Promise<R>;

Defined in: packages/tanstack-start/src/server.ts:96

A guard typed with the names N it accepts and its options O: (request, ...names, options?). It resolves to the subject (R) when the check passes, and throws a Response (401, 403, or a handler's) when it does not.

Type Parameters ​

Type ParameterDefault type
N extends string-
O-
RSubjectRbac

Type Parameters ​

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

Parameters ​

ParameterType
requestRequest
...restX & RequirementArgs<X, N, O>

Returns ​

Promise<R>

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