javascript - 需要帮助使用 Angular Firebase 进行错误处理
问题描述
我正在制作一个聊天服务应用程序,但我遇到了一个我无法找到解决方案的错误。我的代码是:
import { Component, OnInit } from '@angular/core';
import { AuthService } from '../services/auth.service';
import { Observable } from 'rxjs';
import * as firebase from 'firebase/app';
import {User} from '@firebase/auth-types';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css']
})
export class NavbarComponent implements OnInit {
user!: Observable<firebase.User>;
userEmail!: string;
constructor(private authService: AuthService) { }
ngOnInit(): void {
this.authService.authUser();
this.user.subscribe(user => {
if (user) {
this.userEmail = user.email;
}
});
}
logout() {
this.authService.logout();
}
}
我得到的错误是:
命名空间 '"C:/Users/steve/met-chat/node_modules/firebase/index"' 没有导出成员 'User'.ts(2694)
我已确保已将 angular 和 firebase 更新到最新版本。如果有人可以提供帮助,我将不胜感激。
解决方案
推荐阅读
- java - 如何根据倒数计时器模糊图像
- reactjs - 我怎样才能只获取没有状态的数据?
- ios - 使用 SwiftUI 时遇到一些问题(查看详细信息)
- apache-kafka - 如何启动 Zookeper
- r - 如何从ggmap获取黑白地图?
- java - 为什么我不能更改被覆盖方法的返回类型(协变返回类型除外)?
- html - 将 JSON 数组转换为 HTML 表
- css - css 动画在滚动时发生,而不是在页面加载时发生
- arrays - 如何等待带有mongodb查询的嵌套forEach语句返回函数
- android - AdMob 测试广告无法在已发布的 Android 应用版本上运行