angularfire: AngularFire is not compatible with Firebase JS SDK v8
Version info
Angular: v10.2.0
Firebase: v8.0.0
AngularFire: v6.0.3
Other (e.g. Ionic/Cordova, Node, browser, operating system):
Debug output
ERROR in node_modules/@angular/fire/auth/auth.d.ts:4:10 - error TS2614: Module '"../../../firebase"' has no exported member 'User'. Did you mean to use 'import User from "../../../firebase"' instead?
4 import { User, auth } from 'firebase/app';
~~~~
node_modules/@angular/fire/auth/auth.d.ts:4:16 - error TS2614: Module '"../../../firebase"' has no exported member 'auth'. Did you mean to use 'import auth from "../../../firebase"' instead?
4 import { User, auth } from 'firebase/app';
Expected behavior
There should be no errors.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 16
- Comments: 18 (7 by maintainers)
Commits related to this issue
- update angular and firebase libraries - see https://github.com/angular/angularfire/issues/2619 — committed to bdunklau/g2t by deleted user 4 years ago
I still can’t get
auth
andUser
by importingfirebase/app
. It just says it doesn’t have an exported member User and auth.firebase version: 8.2.0 AngularFire version: 6.1.4 Angular version: 11.0.5
@jamesdaniels Sorry for the absence. I tested
6.0.4
withfirebase@7
and it does not work. Infirebase@8
it does work though.Here’s my analysis.
In
firebase@7
, thefirebase
is export as such:So, to be able to use
import firebase from 'firebase';
in AngularFire’s codebase, the user needs to haveallowSyntheticDefaultImports
set astrue
in theirtsconfig.json
.But in
6.0.4
type definition, there is one line that is problematic. Here:https://unpkg.com/browse/@angular/fire@6.0.4/storage/observable/fromTask.d.ts
The
import("firebase").default.storage.UploadTaskSnapshot
does not play very well with"allowSyntheticDefaultImports": true
. Hence, there is this error while building a project with6.0.4
andfirebase@7
:Please take a look. I’m not sure why the generated
.d.ts
is using theimport()
type syntax, though.Ah yeah, they just changed the API in v8 firebase.User is the same thing auth.User used to be.
I have :
I can use
firebase.User
but notfirebase.auth.User
…For those - like me - who arrive here from Google: the docs have a pretty concise summary (https://github.com/angular/angularfire/blob/master/docs/auth/getting-started.md)
Releasing
6.0.4
with support for v8 later today.I am still having the same problem. Angular version 11.0.2 and AngularFire version 6.1.1
Give
6.0.4-canary.9a26fbe
a spin, I’ll be releasing6.0.4
final shortly.