Skip to content

ERROR in ts(24,5): error TS2322: Type 'import("ClientApp/node_modules/@angular/fire/node_modules/rxjs/internal/Observable").Observable<any>' is not assignable to type 'import("ClientApp/node_modules/rxjs/internal/Observable").Observable<any>'. #2062

Closed
@doivosevic

Description

@doivosevic

Deps:


  "dependencies": {
    "@angular/animations": "^8.0.0-rc.2",
    "@angular/cdk": "^8.0.0-rc.0",
    "@angular/common": "^8.0.0-rc.2",
    "@angular/compiler": "^8.0.0-rc.2",
    "@angular/core": "^8.0.0-rc.2",
    "@angular/fire": "^5.2.0-beta.2",
    "@angular/forms": "^8.0.0-rc.2",
    "@angular/http": "^8.0.0-beta.9",
    "@angular/material": "^8.0.0-rc.0",
    "@angular/platform-browser": "^8.0.0-rc.2",
    "@angular/platform-browser-dynamic": "^8.0.0-rc.2",
    "@angular/router": "^8.0.0-rc.2",
    "@types/core-js": "^2.5.0",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^4.3.1",
    "core-js": "^3.0.1",
    "firebase": "^5.11.1",
    "hammerjs": "^2.0.8",
    "ngx-file-drop": "^6.0.0",
    "rxjs": "^6.0.0",
    "tslib": "^1.9.3",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.800.0-rc.2",
    "@angular/cli": "^8.0.0-rc.2",
    "@angular/compiler-cli": "^8.0.0-rc.2",
    "@angular/language-service": "^8.0.0-rc.2",
    "@types/jasmine": "^3.3.12",
    "@types/jasminewd2": "^2.0.6",
    "@types/node": "^12.0.0",
    "codelyzer": "^5.0.1",
    "jasmine-core": "^3.4.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^4.1.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.5",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "^6.0.0",
    "ts-node": "^8.1.0",
    "tslint": "^5.16.0",
    "typescript": "^3.4.0"
  }

I'm trying to upgrade to the release candidate of angular 8. Apart from complaining about how angularfire2 doesn't support version 8 (when will there be a beta release which supports?) I'm also having this issue. My guess would be that the APIs of the rxjs which angularfire uses doesn't match with the version which I'm using.

I checked package.json of angularfire and I see that it's using 5.0.0 . I tried with both 5.0.0 and 5.6.1 in my repo and both reported this issue. I didn't have this problem prior to updating to angularfire 5.2.0 beta.2

This happens when I try using angular fire storage service

import { Injectable } from "@angular/core";
import { AngularFireStorage } from "@angular/fire/storage";
import { Observable } from "rxjs";

export interface HTMLInputEvent extends Event {
target: HTMLInputElement & EventTarget;
}


@Injectable()
export class FileStorageService {

  constructor(private storage: AngularFireStorage) {}

  public uploadFile(event: HTMLInputEvent, fileName: string) {
    if (event.target.files != null) {
      const file = event.target.files[0];
      const ref = this.storage.ref(fileName);

      ref.put(file);
    }
  }

  public getDownloadURL(fileName: string): Observable<any> {
    return this.storage.ref(fileName).getDownloadURL();
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions