Type Alias: Guard<N, O, R>
ts
type Guard<N, O, R> = <A>(event, ...args) => Promise<R>;Defined in: packages/sveltekit/src/server/guards.ts:104
A guard typed with the names N it accepts and its options O: (event, ...names, options?). It resolves to the subject (R) when the check passes, and throws (SvelteKit's error() / redirect(), or your handler) when it does not. 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.
Type Parameters
| Type Parameter | Default type |
|---|---|
N extends string | - |
O | - |
R | SubjectRbac |
Type Parameters
| Type Parameter |
|---|
A extends readonly (GuardNames | O)[] |
Parameters
| Parameter | Type |
|---|---|
event | RequestEvent |
...args | A & RequirementArgs<A, N, O> |
Returns
Promise<R>
