-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
withConverter doesn't work when used with CollectionReference #2601
Comments
I found a few problems with this issue:
|
@maletor Thanks for writing in! The For example, the following code snippet using the const posts = db
.collection('posts')
.withConverter(PostConverter)
.get();
posts.forEach((snapshot: QueryDocumentSnapshot<Post>) => {
const post: Post = snapshot.data();
...
}); |
Can you provide a minimal repro so I can see what's going on? It seems to work fine for me in a local test I wrote with that snippet I posted above, even without the generic type specification. |
@thebrianchen something like this: https://gist.github.com/maletor/cdbe979b10c87a892f6cb9bb3db8f0f0 |
@maletor Thanks for the repro! You are using the admin SDK, which is located at https://github.com/googleapis/nodejs-firestore/. I was able to reproduce this on the admin Node SDK and I'll make a bug fix for it soon. The root cause is that |
@thebrianchen, doesn't the admin SDK simply use the firestore SDK? It's not doing anything different. It's the same type. Correct me if I'm wrong. Addendum: Yup, I'm wrong. |
Marking as closed. The fix for the admin SDK should go out with the next release. |
@thebrianchen, it seems types don't work correctly with CollectionReference.
The forEach callback takes a
QueryDocumentSnapshot
(not a DocumentSnapshot) and there's no way to get the T on that object. It's only onDocumentSnapshot
.Is this by design, can we fix this
The text was updated successfully, but these errors were encountered: