Closed
Labels
comp: firestoreCloud Firestore (src/firestore).comp: typingsTypeScript type correctness across the public API.type: featureNew capability or enhancement.version: legacy (v7-v16)Targets the older modular API (roughly v7-v16).
Milestone
Description
Version info
Angular:
12.2.0
Firebase:
9.4.0
AngularFire:
7.2.0
How to reproduce these conditions
import {
collection,
} from '@angular/fire/firestore';
Expected behavior
collection suppose to receive generic type of collection documents interface. as stated in docs
import { collection } from '@angular/fire/firestore';
collection(firestore, 'foo') // CollectionReference
Actual behavior
generic type is not configured, hence causing a problem on passing to update and doc functions with the generic type of the interface set


.
Reacted by BenLayet
Metadata
Metadata
Assignees
Labels
comp: firestoreCloud Firestore (src/firestore).comp: typingsTypeScript type correctness across the public API.type: featureNew capability or enhancement.version: legacy (v7-v16)Targets the older modular API (roughly v7-v16).
Activity
google-oss-bot commentedon Nov 22, 2021
This issue does not seem to follow the issue template. Make sure you provide all the required information.
RobbyRabbitman commentedon May 19, 2022
I was also surprised, since the other functions are generic. As a workaround u can type it for now manually:
protected readonly resumesCollection = collection( this.firestore, 'resumes' ) as CollectionReference<Resume>;and then those calls will infer the type
getDocs(query(this.resumesCollection, where('user', '==', user?.uid)))armando-navarro commentedon Nov 5, 2026
Thanks for filing this. Sorry this sat for years. It is the same question as #3081, so I am answering in one place: the
collection()signature is the Firebase SDK's own, the typed path iswithConverter(), and #3838 updates the README and quickstart, which were showing the call that fails.The full explanation is on #3081. If that does not work for your use case, let me know and I will follow up.