Skip to content

Commit 936b31d

Browse files
committed
chore: fix types
1 parent 871e4f8 commit 936b31d

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/adapters/_node/request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const NodeRequest = /* @__PURE__ */ (() => {
4040
#formDataBody?: Promise<FormData>;
4141
#jsonBody?: Promise<any>;
4242
#textBody?: Promise<string>;
43-
#bodyStream?: undefined | ReadableStream<Uint8Array>;
43+
#bodyStream?: undefined | ReadableStream<Uint8Array<ArrayBuffer>>;
4444

4545
_node: { req: NodeServerRequest; res?: NodeServerResponse };
4646
runtime: ServerRuntimeContext;
@@ -132,7 +132,7 @@ export const NodeRequest = /* @__PURE__ */ (() => {
132132
return true;
133133
}
134134

135-
get body() {
135+
get body(): ReadableStream<Uint8Array<ArrayBuffer>> | null {
136136
if (!this._hasBody) {
137137
return null;
138138
}

src/adapters/_node/response.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const NodeResponse: {
2424
| Buffer
2525
| Uint8Array
2626
| DataView
27-
| ReadableStream<Uint8Array>
27+
| ReadableStream
2828
| NodeReadable
2929
| undefined
3030
| null;
@@ -128,7 +128,7 @@ export const NodeResponse: {
128128
body = bodyInit as NodeReadable;
129129
} else {
130130
const res = new globalThis.Response(bodyInit as BodyInit);
131-
body = res.body;
131+
body = res.body as ReadableStream<Uint8Array<ArrayBuffer>>;
132132
for (const [key, value] of res.headers) {
133133
headers.push([key, value]);
134134
}
@@ -254,15 +254,17 @@ export const NodeResponse: {
254254
return false; // Not supported
255255
}
256256

257-
get body(): ReadableStream<Uint8Array> | null {
257+
get body(): ReadableStream<Uint8Array<ArrayBuffer>> | null {
258258
if (this.#responseObj) {
259-
return this.#responseObj.body; // Reuse instance
259+
return this.#responseObj.body as ReadableStream<
260+
Uint8Array<ArrayBuffer>
261+
>; // Reuse instance
260262
}
261263
const fastBody = this.#fastBody(ReadableStream);
262264
if (fastBody !== false) {
263-
return fastBody as ReadableStream<Uint8Array>; // Fast path
265+
return fastBody as ReadableStream<Uint8Array<ArrayBuffer>>; // Fast path
264266
}
265-
return this.#response.body; // Slow path
267+
return this.#response.body as ReadableStream<Uint8Array<ArrayBuffer>>; // Slow path
266268
}
267269

268270
get bodyUsed(): boolean {
@@ -296,13 +298,13 @@ export const NodeResponse: {
296298

297299
bytes(): Promise<Uint8Array<ArrayBuffer>> {
298300
if (this.#responseObj) {
299-
return this.#responseObj.bytes(); // Reuse instance
301+
return this.#responseObj.bytes() as Promise<Uint8Array<ArrayBuffer>>; // Reuse instance
300302
}
301303
const fastBody = this.#fastBody(Uint8Array);
302304
if (fastBody !== false) {
303305
return Promise.resolve(fastBody || new Uint8Array()); // Fast path
304306
}
305-
return this.#response.bytes(); // Slow path
307+
return this.#response.bytes() as Promise<Uint8Array<ArrayBuffer>>; // Slow path
306308
}
307309

308310
formData(): Promise<FormData> {

0 commit comments

Comments
 (0)