Property 'firestore' does not exist on type 'FirebaseNamespace' with Firebase v7.15.1

£可爱£侵袭症+ 提交于 2021-02-10 17:52:26

问题


When I upgrade from firebase v7.14.3 to v7.15.1 I get the following build error / typescript error:

TS2339: Property 'firestore' does not exist on type 'FirebaseNamespace'.

I import and use Firestore as following:

import {firebase} from '@firebase/app';
import '@firebase/firestore';

const firestore: firebase.firestore.Firestore = firebase.firestore();

=> firebase.firestore() is my issue.

I have probably missed the CHANGELOG, any help on how to migrate this appreciated!


回答1:


I have always imported Firebase client SDKs in TypeScript like this:

npm install firebase
import * as firebase from 'firebase/app'
import 'firebase/firestore'

const firestore = firebase.firestore()


来源:https://stackoverflow.com/questions/62415105/property-firestore-does-not-exist-on-type-firebasenamespace-with-firebase-v7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!