You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating System version: Linux desktop 5.11.0-36-generic 40~20.04.1-Ubuntu SMP x86_64 GNU/Linux
Browser version: n.a.
Firebase SDK version: 9.1.1
Firebase Product: firestore
[REQUIRED] Describe the problem
Steps to reproduce:
Compile the typescript code below using firebase 9.1.1
Relevant Code:
import{doc,}from"firebase/firestore";import*astypesfrom"@firebase/firestore-types";import{initializeTestEnvironment}from"@firebase/rules-unit-testing";initializeTestEnvironment({}).then((testEnv)=>{constfirestore=testEnv.unauthenticatedContext().firestore();// error on below line: Type 'DocumentReference<DocumentData>' is missing the following properties from type 'DocumentReference<DocumentData>': collection, isEqual, set, update, and 3 more.ts(2740)constdocRef: types.DocumentReference=doc(firestore,"books/foo");});
When I navigate to the typescript declaration file for doc I see the following signatures:
As you can see the return type in the declaration file is DocumentReference which gets imported from @firebase/firestore while in other places in the same declaration file types.DocumentReference is used where types is imported from @firebase/firestore-types.
I would think that the types from @firebase/firestore-types should be compatible with those in firebase/firestore.
The text was updated successfully, but these errors were encountered:
@firebase/firestore-types are compat types. They are compatible with firebase/firestore in the sense that they are accepted in functions exported from firebase/firestore, but the types from the 2 packages are not compatible(you can't assign them to each other). Can you use DocumentReference from firebase/firestore instead?
I have change my code now back to using DocumentReference from firebase/firestore. The reason I had started using @firebase/firestore-types package for my types was this comment here #5550 (comment).
I only needed that one FirebaseFirestore type but got too enthusiast and started using CollectionReference and DocumentReference as well.
[REQUIRED] Describe your environment
Operating System version: Linux desktop 5.11.0-36-generic 40~20.04.1-Ubuntu SMP x86_64 GNU/Linux
Browser version: n.a.
Firebase SDK version: 9.1.1
Firebase Product: firestore
[REQUIRED] Describe the problem
Steps to reproduce:
Compile the typescript code below using firebase 9.1.1
Relevant Code:
When I navigate to the typescript declaration file for
doc
I see the following signatures:As you can see the return type in the declaration file is
DocumentReference
which gets imported from@firebase/firestore
while in other places in the same declaration filetypes.DocumentReference
is used wheretypes
is imported from@firebase/firestore-types
.I would think that the types from
@firebase/firestore-types
should be compatible with those infirebase/firestore
.The text was updated successfully, but these errors were encountered: