angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Namespace 'firebase' has no exported member 'Promise'

Open yazan-alomari opened this issue 9 years ago • 32 comments

Version info

Angular: 4.2.4 Firebase: 4.5.0 AngularFire: 4.0.0-rc0 Other (e.g. Ionic/Cordova, Node, browser, operating system): Node v6.11.3, Windows 7 x64

How to reproduce these conditions

import { Component } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';

interface MovieQuote {
  movie: string;
  quote: string;
  $key?: string;
}

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  formMovieQuote: MovieQuote = {
    'movie': '',
    'quote': ''
  };

  movieQuotesStream: FirebaseListObservable<MovieQuote[]>;

  constructor(db: AngularFireDatabase) {
    this.movieQuotesStream = db.list('/quotes');
  }

  onSubmit() {
    this.formMovieQuote = {
      'movie': '',
      'quote': ''
    };
  }
}

yazan-alomari avatar Oct 03 '17 18:10 yazan-alomari

@mubasshir I downgraded and it is working fine.

"angularfire2": "4.0.0-rc.0", "firebase": "^3.6.6",

I'm too close to completion that I don't want to spend anytime upgrading to v5. Unfortunately, it is generally allowed to introduce breaking changes in rc versions but it's too bad there wasn't much explanation until folks started logging issues. It's the unfortunate side of open source when a major version has this experience then abandoned.

tinomen avatar Oct 27 '17 23:10 tinomen

@tinomen, you can upgrade to V5 and keep the old API. Just switch your database imports to angularfire2/database-deprecated.

but it's too bad there wasn't much explanation until folks started logging issues

I'm sorry that you felt frustration and a bit of surprise with the new version. I tried hard to solicit feedback and create awareness of the upcoming changes. There was a long detailed proposal to the breaking changes that was created three weeks before the 5.0 release. We created a migration guide upon releasing the new version. I want to avoid these frustrating experiences in the future. What else could we do to make this process easier?

davideast avatar Oct 30 '17 13:10 davideast

I get this error but its coming from node_module. my package.json says "angularfire2": "^5.0.0-rc.3",

i did npm update/install and deleted node_modules folder and re-installed..but i keep getting this file with Promise in it.

/node_modules/angularfire2/firebase.app.module.d.ts (12,28): Namespace 'firebase' has no exported member 'Promise'.

angularfire2/database-deprecated does not help me. any idea?

davvit avatar Nov 01 '17 01:11 davvit

I've got "angularfire2": "^5.0.0-rc.3" too, and can't get the right declaration for delete, so... I'm just manually editing firebase.app.module.d.ts and manually changing: delete: () => firebase.Promise<any>; to delete: () => Promise<any>;

Terrible, but I'm doing this just to get back to work until this issue is resolved.

NimaiMalle avatar Nov 01 '17 23:11 NimaiMalle

@davideast I was speaking of the v4 changes. I got the error when npm installed rc.1. 4-rc0 with firebase 3.6.6 doesn't throw the error and I can just move on with dev. When my POC is done I'll evaluate an upgrade to v5

tinomen avatar Nov 02 '17 01:11 tinomen

@NimaiMalle - I know it's less than ideal, but this is an instance where learning to use some of the great GNU tools like find, sed, and grep in a terminal can make your life a little easier. https://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files

ghost avatar Nov 02 '17 16:11 ghost

@NimaiMalle changing from firebase.Promise to Promise is not an issue, actually, I like this, it does not make sense to have many types of the same Promise object! it is confusing also is making unnecessary wrapping and more code just to switch from Promise to firebase.Promise and the way back, this was a headache, it is indeed a good change, especially they were the same and there was nothing special about firebase.Promise anyway.

@tnesbit450 it is not only a "string" to replace! it is a class need to be imported as well! it is not that easy as what you are thinking, it is simply a refactor that you need to do.

almothafar avatar Nov 05 '17 09:11 almothafar

Having "angularfire2": "^5.0.0-rc.3" in my package.json seemed to make yarn install 5.0.0-rc.0-next.

But after checking npm semver calculator, I found that changing the entry in package.json to "angularfire2": "5.0.0-rc.3" (i.e without the carat) causes yarn to install 5.0.0-rc.3 instead of 5.0.0-rc.0-next. This fixed the problem for me.

CharlesSuttie avatar Nov 05 '17 10:11 CharlesSuttie

@almothafar - yeah, Always easier said ham done of course. But, files are nothing but strings. With the exception of binaries, it’s pretty straight forward. And even that can be accounted for. It doesn’t hurt to give it a shot. One simple command in the CLI. And if you can’t make it work, you just roll back the changes in one more simple line of text in a CLI.

ghost avatar Nov 05 '17 19:11 ghost

What I'm seeing is: Namespace 'firebase' has no exported member 'firestore' in the following .d.ts files:

node_modules/angularfire2/firebase.app.module.d.ts node_modules/angularfire2/firestore/collection/changes.d.ts node_modules/angularfire2/firestore/firestore.d.ts node_modules/angularfire2/firestore/interfaces.d.ts node_modules/angularfire2/firestore/observable/fromRef.d.ts

I'm on "angularfire2": "^5.0.0-rc.3".

davhad avatar Nov 06 '17 10:11 davhad

Is there a documentation for v5? Old namespace don't work anymore.

kjvelarde avatar Nov 06 '17 20:11 kjvelarde

I have to do rollback to

"angularfire2": "4.0.0-rc.0",
"firebase": "^3.6.6",

and works for me

here, the steps to migrate to V5. StepsToupdateV5

erscoder avatar Nov 21 '17 09:11 erscoder