From fc7b67c57795936300ceb013c29138c52a0acf4d Mon Sep 17 00:00:00 2001 From: Armando Navarro Date: Wed, 7 Oct 2026 13:24:20 -0700 Subject: [PATCH] fix(storage): give the compat fromTask an explicit return type fromTask declared no return type, so the published typings import whatever path the typings bundler picks for the inferred firebase type. In 20.x that is 'firebase/compat', which firebase's exports map does not list. Apps using moduleResolution "bundler", the setting the @angular/build migration moves apps to, fail with TS2307 in @angular/fire/compat/storage. 21.0.0-rc.1 happens to emit 'firebase/compat/app' and compiles, but ng-packagr 22.2's new typings bundler cannot parse the inferred type and fails the library build. Declaring Observable removes the inferred import. The type is unchanged: UploadTaskSnapshot is the compat alias for firebase.storage.UploadTaskSnapshot. Also drop a comment explaining a firebase import that #3421 removed in 2023 as unused. The import only existed to steer these typings. Fixes #3677 --- src/compat/storage/observable/fromTask.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/compat/storage/observable/fromTask.ts b/src/compat/storage/observable/fromTask.ts index 85f8a34e5..72905b003 100644 --- a/src/compat/storage/observable/fromTask.ts +++ b/src/compat/storage/observable/fromTask.ts @@ -2,12 +2,9 @@ import { Observable } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { UploadTask, UploadTaskSnapshot } from '../interfaces'; -// need to import, else the types become import('firebase/compat/app').default.storage.UploadTask -// and it no longer works w/Firebase v7 - // Things aren't working great, I'm having to put in a lot of work-arounds for what // appear to be Firebase JS SDK bugs https://github.com/firebase/firebase-js-sdk/issues/4158 -export function fromTask(task: UploadTask) { +export function fromTask(task: UploadTask): Observable { return new Observable(subscriber => { const progress = (snap: UploadTaskSnapshot) => subscriber.next(snap); const error = e => subscriber.error(e);