Skip to content

Commit 0394cc9

Browse files
authored
Exclude NodeJS.ReadableStream from compat overloads (#5743)
* Exclude NodeJS.ReadableStream from compat overloads * format fix * Add changeset
1 parent ce39a1a commit 0394cc9

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.changeset/famous-houses-retire.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/storage': patch
3+
'@firebase/storage-compat': patch
4+
---
5+
6+
Fix typings for storage and storage-compat.

packages/storage/src/reference.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ export function getBytesInternal(
170170
.then(bytes =>
171171
maxDownloadSizeBytes !== undefined
172172
? // GCS may not honor the Range header for small files
173-
bytes.slice(0, maxDownloadSizeBytes)
174-
: bytes
173+
(bytes as ArrayBuffer).slice(0, maxDownloadSizeBytes)
174+
: (bytes as ArrayBuffer)
175175
);
176176
}
177177

@@ -194,8 +194,8 @@ export function getBlobInternal(
194194
.then(blob =>
195195
maxDownloadSizeBytes !== undefined
196196
? // GCS may not honor the Range header for small files
197-
blob.slice(0, maxDownloadSizeBytes)
198-
: blob
197+
(blob as Blob).slice(0, maxDownloadSizeBytes)
198+
: (blob as Blob)
199199
);
200200
}
201201

@@ -236,7 +236,7 @@ export function getStreamInternal(
236236

237237
ref.storage
238238
.makeRequestWithTokens(requestInfo, newStreamConnection)
239-
.then(stream => stream.pipe(result))
239+
.then(stream => (stream as NodeJS.ReadableStream).pipe(result))
240240
.catch(e => result.destroy(e));
241241
return result;
242242
}

scripts/build/create-overloads.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ const BUILTIN_TYPES = [
278278
'Blob',
279279
'ServiceWorkerRegistration',
280280
'Record',
281-
'Error'
281+
'Error',
282+
'NodeJS.ReadableStream'
282283
];
283284

284285
// find all types (except for the built-ins and primitives) referenced in the function declaration

0 commit comments

Comments
 (0)