【发布时间】:2020-02-13 23:21:20
【问题描述】:
我正在与 pwa-starter-kit-template-typescript 项目中的 firebase 建立连接并收到此错误:
“typeof firebase”类型上不存在“默认”属性。 ts(2339)
如果我不使用默认值,它会给出错误firebase.auth() does not exist。
我使用的是 Firebase 版本 7.2.0。 firebase 安装正确。
这是我的代码。
import * as firebase from 'firebase';
import 'firebase/auth';
formValidation()
{
var emailid = this.shadowRoot?this.shadowRoot.querySelector("#myemail") as TextElement:null;
var pwd = this.shadowRoot?this.shadowRoot.querySelector("#mypassword") as TextElement:null;
var defaultauth= firebase.default.auth();
if(emailid!=null && pwd!=null){
//this.defaultauth.EmailAuthProvider.credential(emailid.value, pwd.value).catch(function(error: { code: any; message: any; }){
defaultauth.createUserWithEmailAndPassword(emailid.value, pwd.value)
.catch(function(error: { code: any; message: any; }){
console.log(error.code);
console.log(error.message);
});
}
}
【问题讨论】:
-
不知道如何在没有看到代码的情况下提供帮助。
-
好的,我也在发布代码。
-
显示firebase的导入
-
我现在添加了。你可以检查......
-
是的,它已经是真的了....
标签: typescript firebase-realtime-database progressive-web-apps