Skip to content

Commit 04177b8

Browse files
committed
Use the global web type
1 parent ab61023 commit 04177b8

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

packages/next/server/next-server.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { ParsedNextUrl } from '../shared/lib/router/utils/parse-next-url'
88
import type { PrerenderManifest } from '../build'
99
import type { Rewrite } from '../lib/load-custom-routes'
1010
import type { BaseNextRequest, BaseNextResponse } from './base-http'
11-
import type { ReadableStream } from 'next/dist/compiled/web-streams-polyfill/ponyfill'
11+
import type { ReadableStream as ReadableStreamPolyfill } from 'next/dist/compiled/web-streams-polyfill/ponyfill'
1212
import { TransformStream } from 'next/dist/compiled/web-streams-polyfill/ponyfill'
1313

1414
import { execOnce } from '../shared/lib/utils'
@@ -1273,7 +1273,7 @@ export default class NextNodeServer extends BaseServer {
12731273
},
12741274
url: url,
12751275
page: page,
1276-
body: currentBody,
1276+
body: currentBody as unknown as ReadableStream<Uint8Array>,
12771277
},
12781278
useCache: !this.nextConfig.experimental.runtime,
12791279
onWarning: (warning: Error) => {
@@ -1352,7 +1352,7 @@ export default class NextNodeServer extends BaseServer {
13521352
*/
13531353
function requestToBodyStream(
13541354
request: IncomingMessage
1355-
): ReadableStream<Uint8Array> {
1355+
): ReadableStreamPolyfill<Uint8Array> {
13561356
const transform = new TransformStream<Uint8Array, Uint8Array>({
13571357
start(controller) {
13581358
request.on('data', (chunk) => controller.enqueue(chunk))
@@ -1368,8 +1368,8 @@ function requestToBodyStream(
13681368
* A simple utility to take an original stream and have
13691369
* an API to duplicate it without closing it or mutate any variables
13701370
*/
1371-
function teeableStream<T>(originalStream: ReadableStream<T>): {
1372-
duplicate(): ReadableStream<T>
1371+
function teeableStream<T>(originalStream: ReadableStreamPolyfill<T>): {
1372+
duplicate(): ReadableStreamPolyfill<T>
13731373
} {
13741374
return {
13751375
duplicate() {

packages/next/server/web/adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function adapter(params: {
1616
page: params.page,
1717
input: params.request.url,
1818
init: {
19-
body: params.request.body as unknown as ReadableStream<Uint8Array>,
19+
body: params.request.body,
2020
geo: params.request.geo,
2121
headers: fromNodeHeaders(params.request.headers),
2222
ip: params.request.ip,

packages/next/server/web/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { I18NConfig } from '../config-shared'
2-
import type { ReadableStream } from 'next/dist/compiled/web-streams-polyfill/ponyfill'
32
import type { NextRequest } from '../web/spec-extension/request'
43
import type { NextFetchEvent } from '../web/spec-extension/fetch-event'
54
import type { NextResponse } from './spec-extension/response'

0 commit comments

Comments
 (0)