Type Alias: Guard<N, O, A>
ts
type Guard<N, O, A> = <X>(context, ...rest) => Promise<Response | undefined>;Defined in: packages/astro/src/server.ts:120
A guard typed with the names N it accepts and its options O: (context, ...names, options?). It resolves to undefined when the check passes, and to the Response to return (401, 403 or a redirect) when it does not.
Type Parameters
| Type Parameter | Default type |
|---|---|
N extends string | - |
O | - |
A extends AstroContext | AstroContext |
Type Parameters
| Type Parameter |
|---|
X extends readonly (GuardNames | O)[] |
Parameters
| Parameter | Type |
|---|---|
context | A |
...rest | X & RequirementArgs<X, N, O> |
Returns
Promise<Response | undefined>
