firebasenativescriptnativescript-angularnativescript-firebase

Type 'typeof firestore' has no call signatures nativescript 7 @nativescript/firebase plugin


I have a project where I use nativescript with Angular and want to implement Firebase for the back-end. I followed the instructions in the doc of the package and the firebase.init() works without errors. But when I want to use the firestore like here:

const usernameCollection = firebase.firestore().collection("testUsernames");

I get the error:

This expression is not callable. Type 'typeof firestore' has no call signatures.

I import the module like this:

import { firebase } from "@nativescript/firebase";

Solution

  • Your current import brings in the static types and classes, but not the module itself.

    To bring in the module, you need to add /app to the end of the path as (poorly) shown here.

    Wherever you see "nativescript-plugin-firebase", replace it with "@nativescript/firebase".

    import * as firebase from "@nativescript/firebase/app";