diff --git a/packages/next/client/components/not-found.ts b/packages/next/client/components/not-found.ts index e5cad6a30139412..2ca5e894be9bbfa 100644 --- a/packages/next/client/components/not-found.ts +++ b/packages/next/client/components/not-found.ts @@ -1,6 +1,6 @@ export const NOT_FOUND_ERROR_CODE = 'NEXT_NOT_FOUND' -export function notFound() { +export function notFound(): never { // eslint-disable-next-line no-throw-literal const error = new Error(NOT_FOUND_ERROR_CODE) ;(error as any).digest = NOT_FOUND_ERROR_CODE diff --git a/packages/next/client/components/redirect.ts b/packages/next/client/components/redirect.ts index 0b500ae87256f3f..5e685f94edbe0d9 100644 --- a/packages/next/client/components/redirect.ts +++ b/packages/next/client/components/redirect.ts @@ -1,6 +1,6 @@ export const REDIRECT_ERROR_CODE = 'NEXT_REDIRECT' -export function redirect(url: string) { +export function redirect(url: string): never { // eslint-disable-next-line no-throw-literal const error = new Error(REDIRECT_ERROR_CODE) ;(error as any).digest = REDIRECT_ERROR_CODE + ';' + url