Skip to content

Commit

Permalink
fix(firestore, types): add types for Filter constraints on Queries (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
falleco committed Jun 5, 2023
1 parent 9e383cd commit 0785d27
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/firestore/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,24 @@ export namespace FirebaseFirestoreTypes {
* @param value The comparison value.
*/
where(fieldPath: keyof T | FieldPath, opStr: WhereFilterOp, value: any): Query<T>;

/**
* Creates and returns a new Query with the additional filter that documents must contain the specified field and
* the value should satisfy the relation constraint provided.
*
* #### Example
*
* ```js
* // Get all users who's age is 30 or above
* const querySnapshot = await firebase.firestore()
* .collection('users')
* .where(Filter('age', '>=', 30));
* .get();
* ```
*
* @param filter The filter to apply to the query.
*/
where(filter: QueryFilterConstraint | QueryCompositeFilterConstraint): Query<T>;
}

/**
Expand Down Expand Up @@ -2047,6 +2065,11 @@ export namespace FirebaseFirestoreTypes {
*/
Timestamp: typeof Timestamp;

/**
* Returns the `Filter` function.
*/
Filter: typeof Filter;

/**
* Used to set the cache size to unlimited when passing to `cacheSizeBytes` in
* `firebase.firestore().settings()`.
Expand Down Expand Up @@ -2317,6 +2340,8 @@ export const firebase: ReactNativeFirebase.Module & {
): ReactNativeFirebase.FirebaseApp & { firestore(): FirebaseFirestoreTypes.Module };
};

export const Filter: FilterFunction;

export default defaultExport;

/**
Expand Down

0 comments on commit 0785d27

Please sign in to comment.