@@ -46,7 +46,7 @@ export const SETTINGS = new InjectionToken<Settings>('angularfire2.firestore.set
4646 * return ref.where('age', '<', 200);
4747 * });
4848 */
49- export function associateQuery ( collectionRef : CollectionReference , queryFn = ref => ref ) : AssociatedReference {
49+ export function associateQuery < T > ( collectionRef : CollectionReference < T > , queryFn = ref => ref ) : AssociatedReference < T > {
5050 const query = queryFn ( collectionRef ) ;
5151 const ref = collectionRef ;
5252 return { query, ref } ;
@@ -173,14 +173,14 @@ export class AngularFirestore {
173173 collection < T > ( path : string , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > ;
174174 // tslint:disable-next-line:unified-signatures
175175 collection < T > ( ref : CollectionReference , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > ;
176- collection < T > ( pathOrRef : string | CollectionReference , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > {
177- let collectionRef : CollectionReference ;
176+ collection < T > ( pathOrRef : string | CollectionReference < T > , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > {
177+ let collectionRef : CollectionReference < T > ;
178178 if ( typeof pathOrRef === 'string' ) {
179- collectionRef = this . firestore . collection ( pathOrRef ) ;
179+ collectionRef = this . firestore . collection ( pathOrRef ) as firebase . firestore . CollectionReference < T > ;
180180 } else {
181181 collectionRef = pathOrRef ;
182182 }
183- const { ref, query } = associateQuery ( collectionRef , queryFn ) ;
183+ const { ref, query } = associateQuery < T > ( collectionRef , queryFn ) ;
184184 const refInZone = this . schedulers . ngZone . run ( ( ) => ref ) ;
185185 return new AngularFirestoreCollection < T > ( refInZone , query , this ) ;
186186 }
@@ -190,9 +190,9 @@ export class AngularFirestore {
190190 * and an optional query function to narrow the result
191191 * set.
192192 */
193- collectionGroup < T > ( collectionId : string , queryGroupFn ?: QueryGroupFn ) : AngularFirestoreCollectionGroup < T > {
193+ collectionGroup < T > ( collectionId : string , queryGroupFn ?: QueryGroupFn < T > ) : AngularFirestoreCollectionGroup < T > {
194194 const queryFn = queryGroupFn || ( ref => ref ) ;
195- const collectionGroup : Query = this . firestore . collectionGroup ( collectionId ) ;
195+ const collectionGroup : Query < T > = this . firestore . collectionGroup ( collectionId ) as firebase . firestore . Query < T > ;
196196 return new AngularFirestoreCollectionGroup < T > ( queryFn ( collectionGroup ) , this ) ;
197197 }
198198
@@ -205,10 +205,10 @@ export class AngularFirestore {
205205 doc < T > ( path : string ) : AngularFirestoreDocument < T > ;
206206 // tslint:disable-next-line:unified-signatures
207207 doc < T > ( ref : DocumentReference ) : AngularFirestoreDocument < T > ;
208- doc < T > ( pathOrRef : string | DocumentReference ) : AngularFirestoreDocument < T > {
209- let ref : DocumentReference ;
208+ doc < T > ( pathOrRef : string | DocumentReference < T > ) : AngularFirestoreDocument < T > {
209+ let ref : DocumentReference < T > ;
210210 if ( typeof pathOrRef === 'string' ) {
211- ref = this . firestore . doc ( pathOrRef ) ;
211+ ref = this . firestore . doc ( pathOrRef ) as firebase . firestore . DocumentReference < T > ;
212212 } else {
213213 ref = pathOrRef ;
214214 }
0 commit comments