Skip to content

Commit

Permalink
fix(firestore): Filter typing. Filter.or & Filter.and can accept …
Browse files Browse the repository at this point in the history
…each other (#7904)
  • Loading branch information
russellwheatley authored Jul 16, 2024
1 parent 0165fa7 commit f6c12ec
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/firestore/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,19 @@ export namespace FirebaseFirestoreTypes {

export type QueryFilterType = 'OR' | 'AND';

export interface QueryFilterConstraint {
export interface QueryFieldFilterConstraint {
fieldPath: keyof T | FieldPath;
operator: WhereFilterOp;
value: any;
}

export interface QueryCompositeFilterConstraint {
operator: QueryFilterType;
queries: QueryFilterConstraint[];
queries: QueryFieldFilterConstraint[];
}

export type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;

/**
* The Filter functions used to generate an instance of Filter.
*/
Expand All @@ -73,7 +76,11 @@ export namespace FirebaseFirestoreTypes {
* The Filter function used to generate an instance of Filter.
* e.g. Filter('name', '==', 'Ada')
*/
(fieldPath: keyof T | FieldPath, operator: WhereFilterOp, value: any): QueryFilterConstraint;
(
fieldPath: keyof T | FieldPath,
operator: WhereFilterOp,
value: any,
): QueryFieldFilterConstraint;
/**
* The Filter.or() static function used to generate a logical OR query using multiple Filter instances.
* e.g. Filter.or(Filter('name', '==', 'Ada'), Filter('name', '==', 'Bob'))
Expand Down Expand Up @@ -1412,7 +1419,7 @@ export namespace FirebaseFirestoreTypes {
*
* @param filter The filter to apply to the query.
*/
where(filter: QueryFilterConstraint | QueryCompositeFilterConstraint): Query<T>;
where(filter: QueryFilterConstraint): Query<T>;
}

/**
Expand Down

0 comments on commit f6c12ec

Please sign in to comment.