Closed derridHeidegger closed 7 years ago
Hey @derridHeidegger! The recommendation isn't to not import from firebase, but to not import all of firebase.
Use import * as firebase from firebase/app
to get the typings.
that should be clearer :)
i cant use firebase.user
when i use
user:observable
ERROR in src/app/service/auth.service.ts:9:26 - error TS2694: Namespace '"C:/Users/mo-ro/code/myApp/node_modules/firebase/index"' has no exported member 'User'.
9 user:Observable<firebase.User>
~~~~
i use "-": "0.0.1", "@angular/animations": "~10.1.4", "@angular/common": "~10.1.4", "@angular/compiler": "~10.1.4", "@angular/core": "~10.1.4", "@angular/fire": "^6.0.4", "@angular/forms": "~10.1.4", "@angular/localize": "~10.1.4", "@angular/platform-browser": "~10.1.4", "@angular/platform-browser-dynamic": "~10.1.4", "@angular/router": "~10.1.4", "@ng-bootstrap/ng-bootstrap": "^7.0.0", "angularfire2": "^5.4.2", "bootstrap": "^4.5.3", "firebase": "^8.0.0", "firestore-models": "^1.6.3", "rxjs": "~6.6.0", "save": "^2.4.0", "tslib": "^2.0.0", "zone.js": "~0.10.2" }, "devDependencies": { "@angular-devkit/architect": ">= 0.900 < 0.1100", "@angular-devkit/build-angular": "~0.1001.4", "@angular/cli": "^10.1.7", "@angular/compiler-cli": "~10.1.4", "@types/jasmine": "~3.5.0", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.11.1", "codelyzer": "^6.0.0", "firebase-tools": "^8.0.0", "fuzzy": "^0.1.3", "inquirer": "^6.2.2", "inquirer-autocomplete-prompt": "^1.0.1", "jasmine-core": "~3.6.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~5.0.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", "open": "^7.0.3", "protractor": "~7.0.0", "ts-node": "~8.3.0", "tslint": "~6.1.0", "typescript": "~4.0.2" }
It seems you upgraded to v8 of Firebase, this is a major with breaking changes, you need to change your imports to import firebase from 'firebase/app'
there is error apper when useing
user: Observable
error occurs when using it
user: Observable
Version info
@angular/cli: 1.0.1 node: 6.10.0 os: win32 x64 @angular/animations: 4.2.2 @angular/common: 4.2.2 @angular/compiler: 4.2.2 @angular/core: 4.2.2 @angular/forms: 4.2.2 @angular/http: 4.2.2 @angular/material: 2.0.0-beta.6 @angular/platform-browser: 4.2.2 @angular/platform-browser-dynamic: 4.2.2 @angular/router: 4.2.2 @angular/cli: 1.0.1 @angular/compiler-cli: 4.2.2
Angular:
Firebase:
AngularFire:
Other (e.g. Ionic/Cordova, Node, browser, operating system):
How to reproduce these conditions
Failing test unit, Plunkr, or JSFiddle demonstrating the problem
Steps to set up and reproduce
Sample data and security rules
<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->
Debug output
Errors in the JavaScript console
Output from
firebase.database().enableLogging(true);
Screenshots
Expected behavior
Actual behavior
how to use Observable if you suggest:
// Do not import from 'firebase' as you'd lose the tree shaking benefits
if i don't import it i get: Cannot find namespace 'firebase'
is there a full example of checking auth state?