I have the following python snippet...
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
cred = credentials.Certificate("./cert.json")
firebase_admin.initialize_app(cred)
client = firestore.client()
client.
When I type the dot on the last line, no code completion options come up. On the 'firestore' variable, there are code completion options that come up.
I have the Python and Pylance extensions installed in VSCode. Is this a configuration issue, or is there something about what the client() method is returning, that it is not possible to infer its type?
CodePudding user response:
Turns out there was already an open issue for this on the github repo, which also included a temporary (poor) workaround.
from firebase_admin import firestore
from google.cloud.firestore import Client as FirestoreClient # importing the return type of firestore.client()
db: FirestoreClient = firestore.client() # Adding an annotation to my db variable, to enable completion and syntax checking