Module '"@react-native-firebase/firestore"' has no exported member 'CollectionReference'. ts(2614)

1.3k Views Asked by At

I use TypeScript and React native with Firestore (no expo).

On the import:

import { CollectionReference } from '@react-native-firebase/firestore'

I get the error message:

Module '"@react-native-firebase/firestore"' has no exported member 'CollectionReference'. Did you mean to use 'import CollectionReference from "@react-native-firebase/firestore"' instead?ts(2614)

I installed the module, trying both yarn and npm install.

Here is the packages.json points of interest:

{
  "dependencies": {
    "@react-native-firebase/app": "^8.4.3",
    "@react-native-firebase/auth": "^9.2.3",
    "@react-native-firebase/dynamic-links": "^7.5.4",
    "@react-native-firebase/firestore": "^7.8.2",
    "@react-native-firebase/storage": "^7.4.3",
    ...

  },
  "devDependencies": {,
    "ts-node": "^8.10.2",
    "typescript": "^3.9.7"
    ...
  },

}

I can still use @firebase/firestore-types instead but this package is specified as:

This package is not intended for direct usage, and should only be used via the officially supported firebase package.

This is the web pakage, not the one for React Native Firebase.

1

There are 1 best solutions below

2
On

Ok... This is actually nested into FirebaseFirestoreTypes.

I re-exported it for simplicity:

import { FirebaseFirestoreTypes } from '@react-native-firebase/firestore'

export type CollectionReference = FirebaseFirestoreTypes.CollectionReference
export type DocumentReference = FirebaseFirestoreTypes.DocumentReference
export type Timestamp = FirebaseFirestoreTypes.Timestamp