Skip to content

Commit

Permalink
Exclude NodeJS.ReadableStream from compat overloads (#5743)
Browse files Browse the repository at this point in the history
* Exclude NodeJS.ReadableStream from compat overloads

* format fix

* Add changeset
  • Loading branch information
hsubox76 authored Nov 18, 2021
1 parent ce39a1a commit 0394cc9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/famous-houses-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/storage': patch
'@firebase/storage-compat': patch
---

Fix typings for storage and storage-compat.
10 changes: 5 additions & 5 deletions packages/storage/src/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export function getBytesInternal(
.then(bytes =>
maxDownloadSizeBytes !== undefined
? // GCS may not honor the Range header for small files
bytes.slice(0, maxDownloadSizeBytes)
: bytes
(bytes as ArrayBuffer).slice(0, maxDownloadSizeBytes)
: (bytes as ArrayBuffer)
);
}

Expand All @@ -194,8 +194,8 @@ export function getBlobInternal(
.then(blob =>
maxDownloadSizeBytes !== undefined
? // GCS may not honor the Range header for small files
blob.slice(0, maxDownloadSizeBytes)
: blob
(blob as Blob).slice(0, maxDownloadSizeBytes)
: (blob as Blob)
);
}

Expand Down Expand Up @@ -236,7 +236,7 @@ export function getStreamInternal(

ref.storage
.makeRequestWithTokens(requestInfo, newStreamConnection)
.then(stream => stream.pipe(result))
.then(stream => (stream as NodeJS.ReadableStream).pipe(result))
.catch(e => result.destroy(e));
return result;
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/build/create-overloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ const BUILTIN_TYPES = [
'Blob',
'ServiceWorkerRegistration',
'Record',
'Error'
'Error',
'NodeJS.ReadableStream'
];

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

0 comments on commit 0394cc9

Please sign in to comment.