Skip to content

Commit d2d44cb

Browse files
Reduce size impact of Target/TargetImpl pattern
1 parent 5de3ec6 commit d2d44cb

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

packages/firestore/src/core/target.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,27 @@ import { debugCast } from '../util/assert';
2828
* maps to a single WatchTarget in RemoteStore and a single TargetData entry
2929
* in persistence.
3030
*/
31-
export class Target {
32-
protected constructor(
33-
readonly path: ResourcePath,
34-
readonly collectionGroup: string | null,
35-
readonly orderBy: OrderBy[],
36-
readonly filters: Filter[],
37-
readonly limit: number | null,
38-
readonly startAt: Bound | null,
39-
readonly endAt: Bound | null
40-
) {}
31+
export interface Target {
32+
readonly path: ResourcePath;
33+
readonly collectionGroup: string | null;
34+
readonly orderBy: OrderBy[];
35+
readonly filters: Filter[];
36+
readonly limit: number | null;
37+
readonly startAt: Bound | null;
38+
readonly endAt: Bound | null;
4139
}
4240

43-
class TargetImpl extends Target {
41+
class TargetImpl implements Target {
4442
memoizedCanonicalId: string | null = null;
4543
constructor(
46-
path: ResourcePath,
47-
collectionGroup: string | null = null,
48-
orderBy: OrderBy[] = [],
49-
filters: Filter[] = [],
50-
limit: number | null = null,
51-
startAt: Bound | null = null,
52-
endAt: Bound | null = null
53-
) {
54-
super(path, collectionGroup, orderBy, filters, limit, startAt, endAt);
55-
}
44+
readonly path: ResourcePath,
45+
readonly collectionGroup: string | null = null,
46+
readonly orderBy: OrderBy[] = [],
47+
readonly filters: Filter[] = [],
48+
readonly limit: number | null = null,
49+
readonly startAt: Bound | null = null,
50+
readonly endAt: Bound | null = null
51+
) {}
5652
}
5753

5854
/**

0 commit comments

Comments
 (0)