@@ -100,11 +100,11 @@ export type QueryNonFilterConstraint =
100
100
* @throws if any of the provided query constraints cannot be combined with the
101
101
* existing or new constraints.
102
102
*/
103
- export function query < T > (
104
- query : Query < T > ,
103
+ export declare function query < AppModelType , DbModelType extends DocumentData > (
104
+ query : Query < AppModelType , DbModelType > ,
105
105
compositeFilter : QueryCompositeFilterConstraint ,
106
106
...queryConstraints : QueryNonFilterConstraint [ ]
107
- ) : Query < T > ;
107
+ ) : Query < AppModelType , DbModelType > ;
108
108
109
109
/**
110
110
* Creates a new immutable instance of {@link Query} that is extended to also
@@ -116,7 +116,10 @@ export function query<T>(
116
116
* @throws if any of the provided query constraints cannot be combined with the
117
117
* existing or new constraints.
118
118
*/
119
- export function query < T > ( query : Query < T > , ...queryConstraints : IQueryConstraint [ ] ) : Query < T > ;
119
+ export declare function query < AppModelType , DbModelType extends DocumentData > (
120
+ query : Query < AppModelType , DbModelType > ,
121
+ ...queryConstraints : QueryConstraint [ ]
122
+ ) : Query < AppModelType , DbModelType > ;
120
123
121
124
export function query < T > (
122
125
query : Query < T > ,
@@ -173,7 +176,7 @@ export type OrderByDirection = 'desc' | 'asc';
173
176
*/
174
177
export function orderBy (
175
178
fieldPath : string | FieldPath ,
176
- directionStr : OrderByDirection = 'asc' ,
179
+ directionStr ? : OrderByDirection = 'asc' ,
177
180
) : QueryOrderByConstraint ;
178
181
179
182
/**
@@ -285,7 +288,9 @@ export declare function getDocFromServer<T>(
285
288
*
286
289
* @returns A `Promise` that will be resolved with the results of the query.
287
290
*/
288
- export function getDocs < T > ( query : Query < T > ) : Promise < QuerySnapshot < T > > ;
291
+ export declare function getDocs < AppModelType , DbModelType extends DocumentData > (
292
+ query : Query < AppModelType , DbModelType > ,
293
+ ) : Promise < QuerySnapshot < AppModelType , DbModelType > > ;
289
294
290
295
/**
291
296
* Executes the query and returns the results as a `QuerySnapshot` from cache.
@@ -294,15 +299,19 @@ export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
294
299
*
295
300
* @returns A `Promise` that will be resolved with the results of the query.
296
301
*/
297
- export function getDocsFromCache < T > ( query : Query < T > ) : Promise < QuerySnapshot < T > > ;
302
+ export declare function getDocsFromCache < AppModelType , DbModelType extends DocumentData > (
303
+ query : Query < AppModelType , DbModelType > ,
304
+ ) : Promise < QuerySnapshot < AppModelType , DbModelType > > ;
298
305
299
306
/**
300
307
* Executes the query and returns the results as a `QuerySnapshot` from the
301
308
* server. Returns an error if the network is not available.
302
309
*
303
310
* @returns A `Promise` that will be resolved with the results of the query.
304
311
*/
305
- export function getDocsFromServer < T > ( query : Query < T > ) : Promise < QuerySnapshot < T > > ;
312
+ export declare function getDocsFromServer < AppModelType , DbModelType extends DocumentData > (
313
+ query : Query < AppModelType , DbModelType > ,
314
+ ) : Promise < QuerySnapshot < AppModelType , DbModelType > > ;
306
315
307
316
/**
308
317
* Deletes the document referred to by the specified `DocumentReference`.
@@ -311,53 +320,34 @@ export function getDocsFromServer<T>(query: Query<T>): Promise<QuerySnapshot<T>>
311
320
* @returns A Promise resolved once the document has been successfully
312
321
* deleted from the backend (note that it won't resolve while you're offline).
313
322
*/
314
- export function deleteDoc ( reference : DocumentReference < unknown > ) : Promise < void > ;
323
+ export declare function deleteDoc < AppModelType , DbModelType extends DocumentData > (
324
+ reference : DocumentReference < AppModelType , DbModelType > ,
325
+ ) : Promise < void > ;
315
326
316
327
/**
317
- * Creates a `QueryConstraint` with the specified ending point.
318
- *
319
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
320
- * allows you to choose arbitrary starting and ending points for your queries.
321
- *
322
- * The ending point is inclusive, so children with exactly the specified value
323
- * will be included in the query. The optional key argument can be used to
324
- * further limit the range of the query. If it is specified, then children that
325
- * have exactly the specified value must also have a key name less than or equal
326
- * to the specified key.
327
- *
328
- * You can read more about `endAt()` in
329
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
328
+ * Creates a QueryEndAtConstraint that modifies the result set to end at the provided fields relative to the order of the query.
329
+ * The order of the field values must match the order of the order by clauses of the query.
330
330
*
331
- * @param value - The value to end at. The argument type depends on which
332
- * `orderBy*()` function was used in this query. Specify a value that matches
333
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
334
- * value must be a string.
335
- * @param key - The child key to end at, among the children with the previously
336
- * specified priority. This argument is only allowed if ordering by child,
337
- * value, or priority.
331
+ * @param fieldValues
338
332
*/
339
- export function endAt ( value : number | string | boolean | null , key ?: string ) : QueryConstraint ;
333
+ export declare function endAt ( ... fieldValues : unknown [ ] ) : QueryEndAtConstraint ;
340
334
341
335
/**
342
- * Creates a `QueryConstraint` with the specified ending point (exclusive).
343
- *
344
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
345
- * allows you to choose arbitrary starting and ending points for your queries.
346
- *
347
- * The ending point is exclusive. If only a value is provided, children
348
- * with a value less than the specified value will be included in the query.
349
- * If a key is specified, then children must have a value less than or equal
350
- * to the specified value and a key name less than the specified key.
336
+ * reates a QueryEndAtConstraint that modifies the result set to end at the provided document (inclusive).
337
+ * The end position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of the query.
338
+ * @param snapshot
339
+ */
340
+ export function endAt < AppModelType , DbModelType extends DocumentData > (
341
+ snapshot : DocumentSnapshot < AppModelType , DbModelType > ,
342
+ ) : QueryEndAtConstraint ;
343
+
344
+ /**
345
+ * Creates a QueryEndAtConstraint that modifies the result set to end before the provided fields relative to the order of the query.
346
+ * The order of the field values must match the order of the order by clauses of the query.
351
347
*
352
- * @param value - The value to end before. The argument type depends on which
353
- * `orderBy*()` function was used in this query. Specify a value that matches
354
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
355
- * value must be a string.
356
- * @param key - The child key to end before, among the children with the
357
- * previously specified priority. This argument is only allowed if ordering by
358
- * child, value, or priority.
348
+ * @param fieldValues
359
349
*/
360
- export function endBefore ( value : number | string | boolean | null , key ?: string ) : QueryConstraint ;
350
+ export declare function endBefore ( ... fieldValues : unknown [ ] ) : QueryEndAtConstraint ;
361
351
362
352
/**
363
353
* Creates a new `QueryConstraint` that is limited to return only the last
0 commit comments