@@ -46,7 +46,7 @@ export const SETTINGS = new InjectionToken<Settings>('angularfire2.firestore.set
46
46
* return ref.where('age', '<', 200);
47
47
* });
48
48
*/
49
- export function associateQuery ( collectionRef : CollectionReference , queryFn = ref => ref ) : AssociatedReference {
49
+ export function associateQuery < T > ( collectionRef : CollectionReference < T > , queryFn = ref => ref ) : AssociatedReference < T > {
50
50
const query = queryFn ( collectionRef ) ;
51
51
const ref = collectionRef ;
52
52
return { query, ref } ;
@@ -173,14 +173,14 @@ export class AngularFirestore {
173
173
collection < T > ( path : string , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > ;
174
174
// tslint:disable-next-line:unified-signatures
175
175
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 > ;
178
178
if ( typeof pathOrRef === 'string' ) {
179
- collectionRef = this . firestore . collection ( pathOrRef ) ;
179
+ collectionRef = this . firestore . collection ( pathOrRef ) as firebase . firestore . CollectionReference < T > ;
180
180
} else {
181
181
collectionRef = pathOrRef ;
182
182
}
183
- const { ref, query } = associateQuery ( collectionRef , queryFn ) ;
183
+ const { ref, query } = associateQuery < T > ( collectionRef , queryFn ) ;
184
184
const refInZone = this . schedulers . ngZone . run ( ( ) => ref ) ;
185
185
return new AngularFirestoreCollection < T > ( refInZone , query , this ) ;
186
186
}
@@ -190,9 +190,9 @@ export class AngularFirestore {
190
190
* and an optional query function to narrow the result
191
191
* set.
192
192
*/
193
- collectionGroup < T > ( collectionId : string , queryGroupFn ?: QueryGroupFn ) : AngularFirestoreCollectionGroup < T > {
193
+ collectionGroup < T > ( collectionId : string , queryGroupFn ?: QueryGroupFn < T > ) : AngularFirestoreCollectionGroup < T > {
194
194
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 > ;
196
196
return new AngularFirestoreCollectionGroup < T > ( queryFn ( collectionGroup ) , this ) ;
197
197
}
198
198
@@ -205,10 +205,10 @@ export class AngularFirestore {
205
205
doc < T > ( path : string ) : AngularFirestoreDocument < T > ;
206
206
// tslint:disable-next-line:unified-signatures
207
207
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 > ;
210
210
if ( typeof pathOrRef === 'string' ) {
211
- ref = this . firestore . doc ( pathOrRef ) ;
211
+ ref = this . firestore . doc ( pathOrRef ) as firebase . firestore . DocumentReference < T > ;
212
212
} else {
213
213
ref = pathOrRef ;
214
214
}
0 commit comments