diff --git a/packages/next/src/server/web/spec-extension/response.ts b/packages/next/src/server/web/spec-extension/response.ts index 808d0dd00e36c..a43b58b3272ee 100644 --- a/packages/next/src/server/web/spec-extension/response.ts +++ b/packages/next/src/server/web/spec-extension/response.ts @@ -26,10 +26,11 @@ function handleMiddlewareField( } } -export class NextResponse extends Response { +export class NextResponse extends Response { [INTERNALS]: { cookies: ResponseCookies url?: NextURL + body?: Body } constructor(body?: BodyInit | null, init: ResponseInit = {}) { @@ -66,7 +67,10 @@ export class NextResponse extends Response { return this[INTERNALS].cookies } - static json(body: any, init?: ResponseInit): NextResponse { + static json( + body: JsonBody, + init?: ResponseInit + ): NextResponse { // @ts-expect-error This is not in lib/dom right now, and we can't augment it. const response: Response = Response.json(body, init) return new NextResponse(response.body, response)