admin管理员组文章数量:1327945
I am creating user-based content and button show using ionic 5 and the firebase app. I am going through on post and implement it in my application.
I and using :
"firebase": "^8.1.1",
"@angular/fire": "^6.1.3",
Now I got errors in auth()
and firestore()
auth error is : Property 'auth' does not exist on type 'typeof import (TS-2339) AND firebase error is - Property 'firestore' does not exist on type 'typeof import
import { Component, OnInit } from "@angular/core";
import * as firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
@Component({
selector: "app-places",
templateUrl: "./posts.page.html",
styleUrls: ["./posts.page.scss"],
})
export class PlacesPage implements OnInit {
constructor() {}
//firestore = firebase.firestore();
public isAdmin = false;
ngOnInit() {
//Property 'auth' does not exist on type 'typeof import
firebase.auth().onAuthStateChanged((user) => {
if (user) {
firebase
.firestore() //Property 'firestore' does not exist on type 'typeof import
.doc(`s/${user.id}`)
.get()
.then((userProfileSnapshot) => {
this.isAdmin = userProfileSnapshot.data().isAdmin;
});
}
});
}
}
I am creating user-based content and button show using ionic 5 and the firebase app. I am going through on post and implement it in my application.
I and using :
"firebase": "^8.1.1",
"@angular/fire": "^6.1.3",
Now I got errors in auth()
and firestore()
auth error is : Property 'auth' does not exist on type 'typeof import (TS-2339) AND firebase error is - Property 'firestore' does not exist on type 'typeof import
import { Component, OnInit } from "@angular/core";
import * as firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
@Component({
selector: "app-places",
templateUrl: "./posts.page.html",
styleUrls: ["./posts.page.scss"],
})
export class PlacesPage implements OnInit {
constructor() {}
//firestore = firebase.firestore();
public isAdmin = false;
ngOnInit() {
//Property 'auth' does not exist on type 'typeof import
firebase.auth().onAuthStateChanged((user) => {
if (user) {
firebase
.firestore() //Property 'firestore' does not exist on type 'typeof import
.doc(`s/${user.id}`)
.get()
.then((userProfileSnapshot) => {
this.isAdmin = userProfileSnapshot.data().isAdmin;
});
}
});
}
}
Share
edited Dec 1, 2020 at 17:29
Pritesh Bhoi
asked Dec 1, 2020 at 10:26
Pritesh BhoiPritesh Bhoi
1,0964 gold badges16 silver badges38 bronze badges
2
- Please edit the question to show which version of the firebase module you're using. It will be in your package.json. – Doug Stevenson Commented Dec 1, 2020 at 16:09
- @DougStevenson I update question. Thanks – Pritesh Bhoi Commented Dec 1, 2020 at 17:30
1 Answer
Reset to default 9Please review the documentation for importing Firebase SDKs using a module bundler. Starting with Firebase SDK version 8.0.0, you now must import like this:
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
Notice that * as
is no longer part of the import in this version.
本文标签: javascriptfirebase and auth property does not exist in Ionic and FirebaseStack Overflow
版权声明:本文标题:javascript - firebase and auth property does not exist in Ionic and Firebase - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742221549a2435478.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论