Skip to content

Commit 4c5ba7e

Browse files
fix(storage): give the compat fromTask an explicit return type (#3796)
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<UploadTaskSnapshot> 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
1 parent d95316b commit 4c5ba7e

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎src/compat/storage/observable/fromTask.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ import { Observable } from 'rxjs';
22
import { debounceTime } from 'rxjs/operators';
33
import { UploadTask, UploadTaskSnapshot } from '../interfaces';
44

5-
// need to import, else the types become import('firebase/compat/app').default.storage.UploadTask
6-
// and it no longer works w/Firebase v7
7-
85
// Things aren't working great, I'm having to put in a lot of work-arounds for what
96
// appear to be Firebase JS SDK bugs https://github.com/firebase/firebase-js-sdk/issues/4158
10-
export function fromTask(task: UploadTask) {
7+
export function fromTask(task: UploadTask): Observable<UploadTaskSnapshot> {
118
return new Observable<UploadTaskSnapshot>(subscriber => {
129
const progress = (snap: UploadTaskSnapshot) => subscriber.next(snap);
1310
const error = e => subscriber.error(e);

0 commit comments

Comments
 (0)