Skip to content

Commit 7e4521a

Browse files
committed
PR feedback.
1 parent 6b8762a commit 7e4521a

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

common/api-review/firestore-lite.api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class AggregateField<T> {
2323
}
2424

2525
// @public
26-
export type AggregateFieldType = AggregateField<number> | AggregateField<number | null>;
26+
export type AggregateFieldType = AggregateField<number | null>;
2727

2828
// @public
2929
export class AggregateQuerySnapshot<T extends AggregateSpec> {

common/api-review/firestore.api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class AggregateField<T> {
2323
}
2424

2525
// @public
26-
export type AggregateFieldType = AggregateField<number> | AggregateField<number | null>;
26+
export type AggregateFieldType = AggregateField<number | null>;
2727

2828
// @public
2929
export class AggregateQuerySnapshot<T extends AggregateSpec> {

packages/firestore/src/api/aggregate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function getCountFromServer(
7171
*
7272
* Using this function to perform aggregations is efficient because only the
7373
* final aggregation values, not the documents' data, is downloaded. This
74-
* function can even perform aggregations if the documents if the result set
74+
* function can even perform aggregations of the documents if the result set
7575
* would be prohibitively large to download entirely (e.g. thousands of documents).
7676
*
7777
* The result received from the server is presented, unaltered, without

packages/firestore/src/lite-api/aggregate.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function getCount(
6565
*
6666
* Using this function to perform aggregations is efficient because only the
6767
* final aggregation values, not the documents' data, is downloaded. This
68-
* function can even perform aggregations if the documents if the result set
68+
* function can even perform aggregations of the documents if the result set
6969
* would be prohibitively large to download entirely (e.g. thousands of documents).
7070
*
7171
* @param query The query whose result set to aggregate over.
@@ -172,9 +172,9 @@ export function aggregateFieldEqual(
172172
return (
173173
left instanceof AggregateField &&
174174
right instanceof AggregateField &&
175+
left._aggregateType === right._aggregateType &&
175176
left._internalFieldPath?.canonicalString() ===
176-
right._internalFieldPath?.canonicalString() &&
177-
left._aggregateType === right._aggregateType
177+
right._internalFieldPath?.canonicalString()
178178
);
179179
}
180180

packages/firestore/src/lite-api/aggregate_types.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ export class AggregateField<T> {
4545
) {}
4646
}
4747

48+
// TODO (sum/avg) Update the definition of AggregateFieldType to be based
49+
// on the return type of `sum(..)`, `average(...)`, and `count()`
4850
/**
4951
* The union of all `AggregateField` types that are supported by Firestore.
5052
*/
51-
export type AggregateFieldType =
52-
| AggregateField<number>
53-
| AggregateField<number | null>;
53+
export type AggregateFieldType = AggregateField<number | null>;
5454

5555
/**
5656
* Specifies a set of aggregations and their aliases.

packages/firestore/src/remote/datastore.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,7 @@ export async function invokeRunAggregationQueryRpc(
263263
const filteredResult = response.filter(proto => !!proto.result);
264264

265265
hardAssert(
266-
filteredResult.length === 1 &&
267-
filteredResult[0].result !== undefined &&
268-
filteredResult[0].result.aggregateFields !== undefined,
266+
filteredResult.length === 1,
269267
'Aggregation fields are missing from result.'
270268
);
271269

0 commit comments

Comments
 (0)