diff --git a/.changeset/famous-houses-retire.md b/.changeset/famous-houses-retire.md new file mode 100644 index 00000000000..dc30d6b3afb --- /dev/null +++ b/.changeset/famous-houses-retire.md @@ -0,0 +1,6 @@ +--- +'@firebase/storage': patch +'@firebase/storage-compat': patch +--- + +Fix typings for storage and storage-compat. diff --git a/packages/storage/src/reference.ts b/packages/storage/src/reference.ts index 1657ed2383e..ceb3c7dcefa 100644 --- a/packages/storage/src/reference.ts +++ b/packages/storage/src/reference.ts @@ -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) ); } @@ -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) ); } @@ -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; } diff --git a/scripts/build/create-overloads.ts b/scripts/build/create-overloads.ts index 906dda8ea04..67f0f0a09dc 100644 --- a/scripts/build/create-overloads.ts +++ b/scripts/build/create-overloads.ts @@ -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