Skip to content

Commit 0785d27

Browse files
authored
fix(firestore, types): add types for Filter constraints on Queries (#7124)
1 parent 9e383cd commit 0785d27

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/firestore/lib/index.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,24 @@ export namespace FirebaseFirestoreTypes {
13951395
* @param value The comparison value.
13961396
*/
13971397
where(fieldPath: keyof T | FieldPath, opStr: WhereFilterOp, value: any): Query<T>;
1398+
1399+
/**
1400+
* Creates and returns a new Query with the additional filter that documents must contain the specified field and
1401+
* the value should satisfy the relation constraint provided.
1402+
*
1403+
* #### Example
1404+
*
1405+
* ```js
1406+
* // Get all users who's age is 30 or above
1407+
* const querySnapshot = await firebase.firestore()
1408+
* .collection('users')
1409+
* .where(Filter('age', '>=', 30));
1410+
* .get();
1411+
* ```
1412+
*
1413+
* @param filter The filter to apply to the query.
1414+
*/
1415+
where(filter: QueryFilterConstraint | QueryCompositeFilterConstraint): Query<T>;
13981416
}
13991417

14001418
/**
@@ -2047,6 +2065,11 @@ export namespace FirebaseFirestoreTypes {
20472065
*/
20482066
Timestamp: typeof Timestamp;
20492067

2068+
/**
2069+
* Returns the `Filter` function.
2070+
*/
2071+
Filter: typeof Filter;
2072+
20502073
/**
20512074
* Used to set the cache size to unlimited when passing to `cacheSizeBytes` in
20522075
* `firebase.firestore().settings()`.
@@ -2317,6 +2340,8 @@ export const firebase: ReactNativeFirebase.Module & {
23172340
): ReactNativeFirebase.FirebaseApp & { firestore(): FirebaseFirestoreTypes.Module };
23182341
};
23192342

2343+
export const Filter: FilterFunction;
2344+
23202345
export default defaultExport;
23212346

23222347
/**

0 commit comments

Comments
 (0)