Unverified Commit 32383521 authored by S. Suzuki's avatar S. Suzuki Committed by GitHub

fix(ts): More strict Redirect type (#38277)

* fix(ts): More strict Redirect type

* lint-fix
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent dc13c12c
...@@ -42,9 +42,16 @@ export type Redirect = { ...@@ -42,9 +42,16 @@ export type Redirect = {
basePath?: false basePath?: false
locale?: false locale?: false
has?: RouteHas[] has?: RouteHas[]
statusCode?: number } & (
permanent?: boolean | {
} statusCode?: never
permanent: boolean
}
| {
statusCode: number
permanent?: never
}
)
export const allowedStatusCodes = new Set([301, 302, 303, 307, 308]) export const allowedStatusCodes = new Set([301, 302, 303, 307, 308])
const allowedHasTypes = new Set(['header', 'cookie', 'query', 'host']) const allowedHasTypes = new Set(['header', 'cookie', 'query', 'host'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment