From 619414d0119e6a2ccf2c3b1e8efe45845f2b3d8e Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Thu, 6 Jul 2023 15:41:41 -0400 Subject: [PATCH 1/4] firestore-types: fix typings to be consistent with the breaking changes for UpdateData from https://github.com/firebase/firebase-js-sdk/pull/7310 --- packages/firestore-types/index.d.ts | 232 ++++++++++++++++++---------- 1 file changed, 150 insertions(+), 82 deletions(-) diff --git a/packages/firestore-types/index.d.ts b/packages/firestore-types/index.d.ts index d198fd78866..9657432b238 100644 --- a/packages/firestore-types/index.d.ts +++ b/packages/firestore-types/index.d.ts @@ -49,11 +49,20 @@ export type LogLevel = export function setLogLevel(logLevel: LogLevel): void; -export interface FirestoreDataConverter { - toFirestore(modelObject: T): DocumentData; - toFirestore(modelObject: Partial, options: SetOptions): DocumentData; +export interface FirestoreDataConverter< + AppModelType, + DbModelType extends DocumentData = DocumentData +> { + toFirestore(modelObject: AppModelType): DbModelType; + toFirestore( + modelObject: Partial, + options: SetOptions + ): Partial; - fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): T; + fromFirestore( + snapshot: QueryDocumentSnapshot, + options: SnapshotOptions + ): AppModelType; } export class FirebaseFirestore { @@ -71,11 +80,13 @@ export class FirebaseFirestore { enablePersistence(settings?: PersistenceSettings): Promise; - collection(collectionPath: string): CollectionReference; + collection( + collectionPath: string + ): CollectionReference; - doc(documentPath: string): DocumentReference; + doc(documentPath: string): DocumentReference; - collectionGroup(collectionId: string): Query; + collectionGroup(collectionId: string): Query; runTransaction( updateFunction: (transaction: Transaction) => Promise @@ -106,7 +117,7 @@ export class FirebaseFirestore { bundleData: ArrayBuffer | ReadableStream | string ): LoadBundleTask; - namedQuery(name: string): Promise | null>; + namedQuery(name: string): Promise | null>; INTERNAL: { delete: () => Promise }; } @@ -185,45 +196,63 @@ export class Blob { export class Transaction { private constructor(); - get(documentRef: DocumentReference): Promise>; + get( + documentRef: DocumentReference + ): Promise>; - set( - documentRef: DocumentReference, - data: Partial, + set( + documentRef: DocumentReference, + data: Partial, options: SetOptions ): Transaction; - set(documentRef: DocumentReference, data: T): Transaction; + set( + documentRef: DocumentReference, + data: AppModelType + ): Transaction; - update(documentRef: DocumentReference, data: UpdateData): Transaction; - update( - documentRef: DocumentReference, + update( + documentRef: DocumentReference, + data: DbModelType + ): Transaction; + update( + documentRef: DocumentReference, field: string | FieldPath, value: any, ...moreFieldsAndValues: any[] ): Transaction; - delete(documentRef: DocumentReference): Transaction; + delete( + documentRef: DocumentReference + ): Transaction; } export class WriteBatch { private constructor(); - set( - documentRef: DocumentReference, - data: Partial, + set( + documentRef: DocumentReference, + data: Partial, options: SetOptions ): WriteBatch; - set(documentRef: DocumentReference, data: T): WriteBatch; + set( + documentRef: DocumentReference, + data: AppModelType + ): WriteBatch; - update(documentRef: DocumentReference, data: UpdateData): WriteBatch; - update( - documentRef: DocumentReference, + update( + documentRef: DocumentReference, + data: DbModelType + ): WriteBatch; + update( + documentRef: DocumentReference, field: string | FieldPath, value: any, ...moreFieldsAndValues: any[] ): WriteBatch; - delete(documentRef: DocumentReference): WriteBatch; + delete( + documentRef: DocumentReference + ): WriteBatch; commit(): Promise; } @@ -241,22 +270,27 @@ export interface GetOptions { readonly source?: 'default' | 'server' | 'cache'; } -export class DocumentReference { +export class DocumentReference< + AppModelType = DocumentData, + DbModelType extends DocumentData = DocumentData +> { private constructor(); readonly id: string; readonly firestore: FirebaseFirestore; - readonly parent: CollectionReference; + readonly parent: CollectionReference; readonly path: string; - collection(collectionPath: string): CollectionReference; + collection( + collectionPath: string + ): CollectionReference; - isEqual(other: DocumentReference): boolean; + isEqual(other: DocumentReference): boolean; - set(data: Partial, options: SetOptions): Promise; - set(data: T): Promise; + set(data: Partial, options: SetOptions): Promise; + set(data: AppModelType): Promise; - update(data: UpdateData): Promise; + update(data: DbModelType): Promise; update( field: string | FieldPath, value: any, @@ -265,35 +299,39 @@ export class DocumentReference { delete(): Promise; - get(options?: GetOptions): Promise>; + get( + options?: GetOptions + ): Promise>; onSnapshot(observer: { - next?: (snapshot: DocumentSnapshot) => void; + next?: (snapshot: DocumentSnapshot) => void; error?: (error: FirestoreError) => void; complete?: () => void; }): () => void; onSnapshot( options: SnapshotListenOptions, observer: { - next?: (snapshot: DocumentSnapshot) => void; + next?: (snapshot: DocumentSnapshot) => void; error?: (error: FirestoreError) => void; complete?: () => void; } ): () => void; onSnapshot( - onNext: (snapshot: DocumentSnapshot) => void, + onNext: (snapshot: DocumentSnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void ): () => void; onSnapshot( options: SnapshotListenOptions, - onNext: (snapshot: DocumentSnapshot) => void, + onNext: (snapshot: DocumentSnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void ): () => void; - withConverter(converter: null): DocumentReference; - withConverter(converter: FirestoreDataConverter): DocumentReference; + withConverter(converter: null): DocumentReference; + withConverter( + converter: FirestoreDataConverter + ): DocumentReference; } export interface SnapshotOptions { @@ -307,27 +345,31 @@ export interface SnapshotMetadata { isEqual(other: SnapshotMetadata): boolean; } -export class DocumentSnapshot { +export class DocumentSnapshot< + AppModelType = DocumentData, + DbModelType extends DocumentData = DocumentData +> { protected constructor(); readonly exists: boolean; - readonly ref: DocumentReference; + readonly ref: DocumentReference; readonly id: string; readonly metadata: SnapshotMetadata; - data(options?: SnapshotOptions): T | undefined; + data(options?: SnapshotOptions): AppModelType | undefined; get(fieldPath: string | FieldPath, options?: SnapshotOptions): any; - isEqual(other: DocumentSnapshot): boolean; + isEqual(other: DocumentSnapshot): boolean; } export class QueryDocumentSnapshot< - T = DocumentData -> extends DocumentSnapshot { + AppModelType = DocumentData, + DbModelType extends DocumentData = DocumentData +> extends DocumentSnapshot { private constructor(); - data(options?: SnapshotOptions): T; + data(options?: SnapshotOptions): AppModelType; } export type OrderByDirection = 'desc' | 'asc'; @@ -344,7 +386,10 @@ export type WhereFilterOp = | 'array-contains-any' | 'not-in'; -export class Query { +export class Query< + AppModelType = DocumentData, + DbModelType extends DocumentData = DocumentData +> { protected constructor(); readonly firestore: FirebaseFirestore; @@ -353,54 +398,60 @@ export class Query { fieldPath: string | FieldPath, opStr: WhereFilterOp, value: any - ): Query; + ): Query; orderBy( fieldPath: string | FieldPath, directionStr?: OrderByDirection - ): Query; + ): Query; - limit(limit: number): Query; + limit(limit: number): Query; - limitToLast(limit: number): Query; + limitToLast(limit: number): Query; - startAt(snapshot: DocumentSnapshot): Query; - startAt(...fieldValues: any[]): Query; + startAt( + snapshot: DocumentSnapshot + ): Query; + startAt(...fieldValues: any[]): Query; - startAfter(snapshot: DocumentSnapshot): Query; - startAfter(...fieldValues: any[]): Query; + startAfter( + snapshot: DocumentSnapshot + ): Query; + startAfter(...fieldValues: any[]): Query; - endBefore(snapshot: DocumentSnapshot): Query; - endBefore(...fieldValues: any[]): Query; + endBefore( + snapshot: DocumentSnapshot + ): Query; + endBefore(...fieldValues: any[]): Query; - endAt(snapshot: DocumentSnapshot): Query; - endAt(...fieldValues: any[]): Query; + endAt(snapshot: DocumentSnapshot): Query; + endAt(...fieldValues: any[]): Query; - isEqual(other: Query): boolean; + isEqual(other: Query): boolean; - get(options?: GetOptions): Promise>; + get(options?: GetOptions): Promise>; onSnapshot(observer: { - next?: (snapshot: QuerySnapshot) => void; + next?: (snapshot: QuerySnapshot) => void; error?: (error: FirestoreError) => void; complete?: () => void; }): () => void; onSnapshot( options: SnapshotListenOptions, observer: { - next?: (snapshot: QuerySnapshot) => void; + next?: (snapshot: QuerySnapshot) => void; error?: (error: FirestoreError) => void; complete?: () => void; } ): () => void; onSnapshot( - onNext: (snapshot: QuerySnapshot) => void, + onNext: (snapshot: QuerySnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void ): () => void; onSnapshot( options: SnapshotListenOptions, - onNext: (snapshot: QuerySnapshot) => void, + onNext: (snapshot: QuerySnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void ): () => void; @@ -409,51 +460,68 @@ export class Query { withConverter(converter: FirestoreDataConverter): Query; } -export class QuerySnapshot { +export class QuerySnapshot< + AppModelType = DocumentData, + DbModelType extends DocumentData = DocumentData +> { private constructor(); - readonly query: Query; + readonly query: Query; readonly metadata: SnapshotMetadata; - readonly docs: Array>; + readonly docs: Array>; readonly size: number; readonly empty: boolean; - docChanges(options?: SnapshotListenOptions): Array>; + docChanges( + options?: SnapshotListenOptions + ): Array>; forEach( - callback: (result: QueryDocumentSnapshot) => void, + callback: ( + result: QueryDocumentSnapshot + ) => void, thisArg?: any ): void; - isEqual(other: QuerySnapshot): boolean; + isEqual(other: QuerySnapshot): boolean; } export type DocumentChangeType = 'added' | 'removed' | 'modified'; -export interface DocumentChange { +export interface DocumentChange< + AppModelType = DocumentData, + DbModelType extends DocumentData = DocumentData +> { readonly type: DocumentChangeType; - readonly doc: QueryDocumentSnapshot; + readonly doc: QueryDocumentSnapshot; readonly oldIndex: number; readonly newIndex: number; } -export class CollectionReference extends Query { +export class CollectionReference< + AppModelType = DocumentData, + DbModelType extends DocumentData = DocumentData +> extends Query { private constructor(); readonly id: string; - readonly parent: DocumentReference | null; + readonly parent: DocumentReference | null; readonly path: string; - doc(documentPath?: string): DocumentReference; + doc(documentPath?: string): DocumentReference; - add(data: T): Promise>; + add( + data: AppModelType + ): Promise>; - isEqual(other: CollectionReference): boolean; + isEqual(other: CollectionReference): boolean; - withConverter(converter: null): CollectionReference; - withConverter( - converter: FirestoreDataConverter - ): CollectionReference; + withConverter( + converter: null + ): CollectionReference; + withConverter( + converter: FirestoreDataConverter + ): CollectionReference; } export class FieldValue { From 7699320bba532f1dc887cdca8895dfe19facbc3c Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Thu, 6 Jul 2023 15:44:03 -0400 Subject: [PATCH 2/4] yarn changeset --- .changeset/empty-boats-dream.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/empty-boats-dream.md diff --git a/.changeset/empty-boats-dream.md b/.changeset/empty-boats-dream.md new file mode 100644 index 00000000000..03c595000e4 --- /dev/null +++ b/.changeset/empty-boats-dream.md @@ -0,0 +1,6 @@ +--- +'@firebase/firestore-types': major +'firebase': major +--- + +Update to be consistent with the FirestoreDataConverter changes from #7310 From 4e38a0e73c0965482a18bab51645768dd10fae80 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Thu, 6 Jul 2023 20:38:23 +0000 Subject: [PATCH 3/4] simplify the changes to firestore-types/index.d.ts by pinning DbModelType to DocumentData --- packages/firestore-types/index.d.ts | 230 +++++++++++----------------- 1 file changed, 89 insertions(+), 141 deletions(-) diff --git a/packages/firestore-types/index.d.ts b/packages/firestore-types/index.d.ts index 9657432b238..5864cdba5ed 100644 --- a/packages/firestore-types/index.d.ts +++ b/packages/firestore-types/index.d.ts @@ -49,20 +49,11 @@ export type LogLevel = export function setLogLevel(logLevel: LogLevel): void; -export interface FirestoreDataConverter< - AppModelType, - DbModelType extends DocumentData = DocumentData -> { - toFirestore(modelObject: AppModelType): DbModelType; - toFirestore( - modelObject: Partial, - options: SetOptions - ): Partial; +export interface FirestoreDataConverter { + toFirestore(modelObject: T): DocumentData; + toFirestore(modelObject: Partial, options: SetOptions): DocumentData; - fromFirestore( - snapshot: QueryDocumentSnapshot, - options: SnapshotOptions - ): AppModelType; + fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): T; } export class FirebaseFirestore { @@ -80,13 +71,11 @@ export class FirebaseFirestore { enablePersistence(settings?: PersistenceSettings): Promise; - collection( - collectionPath: string - ): CollectionReference; + collection(collectionPath: string): CollectionReference; - doc(documentPath: string): DocumentReference; + doc(documentPath: string): DocumentReference; - collectionGroup(collectionId: string): Query; + collectionGroup(collectionId: string): Query; runTransaction( updateFunction: (transaction: Transaction) => Promise @@ -117,7 +106,7 @@ export class FirebaseFirestore { bundleData: ArrayBuffer | ReadableStream | string ): LoadBundleTask; - namedQuery(name: string): Promise | null>; + namedQuery(name: string): Promise | null>; INTERNAL: { delete: () => Promise }; } @@ -196,63 +185,45 @@ export class Blob { export class Transaction { private constructor(); - get( - documentRef: DocumentReference - ): Promise>; + get(documentRef: DocumentReference): Promise>; - set( - documentRef: DocumentReference, - data: Partial, + set( + documentRef: DocumentReference, + data: Partial, options: SetOptions ): Transaction; - set( - documentRef: DocumentReference, - data: AppModelType - ): Transaction; + set(documentRef: DocumentReference, data: T): Transaction; - update( - documentRef: DocumentReference, - data: DbModelType - ): Transaction; - update( - documentRef: DocumentReference, + update(documentRef: DocumentReference, data: UpdateData): Transaction; + update( + documentRef: DocumentReference, field: string | FieldPath, value: any, ...moreFieldsAndValues: any[] ): Transaction; - delete( - documentRef: DocumentReference - ): Transaction; + delete(documentRef: DocumentReference): Transaction; } export class WriteBatch { private constructor(); - set( - documentRef: DocumentReference, - data: Partial, + set( + documentRef: DocumentReference, + data: Partial, options: SetOptions ): WriteBatch; - set( - documentRef: DocumentReference, - data: AppModelType - ): WriteBatch; + set(documentRef: DocumentReference, data: T): WriteBatch; - update( - documentRef: DocumentReference, - data: DbModelType - ): WriteBatch; - update( - documentRef: DocumentReference, + update(documentRef: DocumentReference, data: UpdateData): WriteBatch; + update( + documentRef: DocumentReference, field: string | FieldPath, value: any, ...moreFieldsAndValues: any[] ): WriteBatch; - delete( - documentRef: DocumentReference - ): WriteBatch; + delete(documentRef: DocumentReference): WriteBatch; commit(): Promise; } @@ -271,26 +242,24 @@ export interface GetOptions { } export class DocumentReference< - AppModelType = DocumentData, - DbModelType extends DocumentData = DocumentData + T = DocumentData, + U extends DocumentData = DocumentData > { private constructor(); readonly id: string; readonly firestore: FirebaseFirestore; - readonly parent: CollectionReference; + readonly parent: CollectionReference; readonly path: string; - collection( - collectionPath: string - ): CollectionReference; + collection(collectionPath: string): CollectionReference; - isEqual(other: DocumentReference): boolean; + isEqual(other: DocumentReference): boolean; - set(data: Partial, options: SetOptions): Promise; - set(data: AppModelType): Promise; + set(data: Partial, options: SetOptions): Promise; + set(data: T): Promise; - update(data: DbModelType): Promise; + update(data: UpdateData): Promise; update( field: string | FieldPath, value: any, @@ -299,39 +268,35 @@ export class DocumentReference< delete(): Promise; - get( - options?: GetOptions - ): Promise>; + get(options?: GetOptions): Promise>; onSnapshot(observer: { - next?: (snapshot: DocumentSnapshot) => void; + next?: (snapshot: DocumentSnapshot) => void; error?: (error: FirestoreError) => void; complete?: () => void; }): () => void; onSnapshot( options: SnapshotListenOptions, observer: { - next?: (snapshot: DocumentSnapshot) => void; + next?: (snapshot: DocumentSnapshot) => void; error?: (error: FirestoreError) => void; complete?: () => void; } ): () => void; onSnapshot( - onNext: (snapshot: DocumentSnapshot) => void, + onNext: (snapshot: DocumentSnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void ): () => void; onSnapshot( options: SnapshotListenOptions, - onNext: (snapshot: DocumentSnapshot) => void, + onNext: (snapshot: DocumentSnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void ): () => void; - withConverter(converter: null): DocumentReference; - withConverter( - converter: FirestoreDataConverter - ): DocumentReference; + withConverter(converter: null): DocumentReference; + withConverter(converter: FirestoreDataConverter): DocumentReference; } export interface SnapshotOptions { @@ -346,30 +311,30 @@ export interface SnapshotMetadata { } export class DocumentSnapshot< - AppModelType = DocumentData, - DbModelType extends DocumentData = DocumentData + T = DocumentData, + U extends DocumentData = DocumentData > { protected constructor(); readonly exists: boolean; - readonly ref: DocumentReference; + readonly ref: DocumentReference; readonly id: string; readonly metadata: SnapshotMetadata; - data(options?: SnapshotOptions): AppModelType | undefined; + data(options?: SnapshotOptions): T | undefined; get(fieldPath: string | FieldPath, options?: SnapshotOptions): any; - isEqual(other: DocumentSnapshot): boolean; + isEqual(other: DocumentSnapshot): boolean; } export class QueryDocumentSnapshot< - AppModelType = DocumentData, - DbModelType extends DocumentData = DocumentData -> extends DocumentSnapshot { + T = DocumentData, + U extends DocumentData = DocumentData +> extends DocumentSnapshot { private constructor(); - data(options?: SnapshotOptions): AppModelType; + data(options?: SnapshotOptions): T; } export type OrderByDirection = 'desc' | 'asc'; @@ -386,10 +351,7 @@ export type WhereFilterOp = | 'array-contains-any' | 'not-in'; -export class Query< - AppModelType = DocumentData, - DbModelType extends DocumentData = DocumentData -> { +export class Query { protected constructor(); readonly firestore: FirebaseFirestore; @@ -398,60 +360,54 @@ export class Query< fieldPath: string | FieldPath, opStr: WhereFilterOp, value: any - ): Query; + ): Query; orderBy( fieldPath: string | FieldPath, directionStr?: OrderByDirection - ): Query; + ): Query; - limit(limit: number): Query; + limit(limit: number): Query; - limitToLast(limit: number): Query; + limitToLast(limit: number): Query; - startAt( - snapshot: DocumentSnapshot - ): Query; - startAt(...fieldValues: any[]): Query; + startAt(snapshot: DocumentSnapshot): Query; + startAt(...fieldValues: any[]): Query; - startAfter( - snapshot: DocumentSnapshot - ): Query; - startAfter(...fieldValues: any[]): Query; + startAfter(snapshot: DocumentSnapshot): Query; + startAfter(...fieldValues: any[]): Query; - endBefore( - snapshot: DocumentSnapshot - ): Query; - endBefore(...fieldValues: any[]): Query; + endBefore(snapshot: DocumentSnapshot): Query; + endBefore(...fieldValues: any[]): Query; - endAt(snapshot: DocumentSnapshot): Query; - endAt(...fieldValues: any[]): Query; + endAt(snapshot: DocumentSnapshot): Query; + endAt(...fieldValues: any[]): Query; - isEqual(other: Query): boolean; + isEqual(other: Query): boolean; - get(options?: GetOptions): Promise>; + get(options?: GetOptions): Promise>; onSnapshot(observer: { - next?: (snapshot: QuerySnapshot) => void; + next?: (snapshot: QuerySnapshot) => void; error?: (error: FirestoreError) => void; complete?: () => void; }): () => void; onSnapshot( options: SnapshotListenOptions, observer: { - next?: (snapshot: QuerySnapshot) => void; + next?: (snapshot: QuerySnapshot) => void; error?: (error: FirestoreError) => void; complete?: () => void; } ): () => void; onSnapshot( - onNext: (snapshot: QuerySnapshot) => void, + onNext: (snapshot: QuerySnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void ): () => void; onSnapshot( options: SnapshotListenOptions, - onNext: (snapshot: QuerySnapshot) => void, + onNext: (snapshot: QuerySnapshot) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void ): () => void; @@ -461,67 +417,59 @@ export class Query< } export class QuerySnapshot< - AppModelType = DocumentData, - DbModelType extends DocumentData = DocumentData + T = DocumentData, + U extends DocumentData = DocumentData > { private constructor(); - readonly query: Query; + readonly query: Query; readonly metadata: SnapshotMetadata; - readonly docs: Array>; + readonly docs: Array>; readonly size: number; readonly empty: boolean; - docChanges( - options?: SnapshotListenOptions - ): Array>; + docChanges(options?: SnapshotListenOptions): Array>; forEach( - callback: ( - result: QueryDocumentSnapshot - ) => void, + callback: (result: QueryDocumentSnapshot) => void, thisArg?: any ): void; - isEqual(other: QuerySnapshot): boolean; + isEqual(other: QuerySnapshot): boolean; } export type DocumentChangeType = 'added' | 'removed' | 'modified'; export interface DocumentChange< - AppModelType = DocumentData, - DbModelType extends DocumentData = DocumentData + T = DocumentData, + U extends DocumentData = DocumentData > { readonly type: DocumentChangeType; - readonly doc: QueryDocumentSnapshot; + readonly doc: QueryDocumentSnapshot; readonly oldIndex: number; readonly newIndex: number; } export class CollectionReference< - AppModelType = DocumentData, - DbModelType extends DocumentData = DocumentData -> extends Query { + T = DocumentData, + U extends DocumentData = DocumentData +> extends Query { private constructor(); readonly id: string; - readonly parent: DocumentReference | null; + readonly parent: DocumentReference | null; readonly path: string; - doc(documentPath?: string): DocumentReference; + doc(documentPath?: string): DocumentReference; - add( - data: AppModelType - ): Promise>; + add(data: T): Promise>; - isEqual(other: CollectionReference): boolean; + isEqual(other: CollectionReference): boolean; - withConverter( - converter: null - ): CollectionReference; - withConverter( - converter: FirestoreDataConverter - ): CollectionReference; + withConverter(converter: null): CollectionReference; + withConverter( + converter: FirestoreDataConverter + ): CollectionReference; } export class FieldValue { From c287f55535134923cca68ce4fd5fb4386689e55a Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Thu, 6 Jul 2023 20:41:07 +0000 Subject: [PATCH 4/4] rename the 2nd type parameter from 'U' to 'T2' to avoid conflicts with other methods that use 'U' as a type parameter --- packages/firestore-types/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/firestore-types/index.d.ts b/packages/firestore-types/index.d.ts index 5864cdba5ed..7c813b55cbb 100644 --- a/packages/firestore-types/index.d.ts +++ b/packages/firestore-types/index.d.ts @@ -243,7 +243,7 @@ export interface GetOptions { export class DocumentReference< T = DocumentData, - U extends DocumentData = DocumentData + T2 extends DocumentData = DocumentData > { private constructor(); @@ -312,7 +312,7 @@ export interface SnapshotMetadata { export class DocumentSnapshot< T = DocumentData, - U extends DocumentData = DocumentData + T2 extends DocumentData = DocumentData > { protected constructor(); @@ -330,8 +330,8 @@ export class DocumentSnapshot< export class QueryDocumentSnapshot< T = DocumentData, - U extends DocumentData = DocumentData -> extends DocumentSnapshot { + T2 extends DocumentData = DocumentData +> extends DocumentSnapshot { private constructor(); data(options?: SnapshotOptions): T; @@ -351,7 +351,7 @@ export type WhereFilterOp = | 'array-contains-any' | 'not-in'; -export class Query { +export class Query { protected constructor(); readonly firestore: FirebaseFirestore; @@ -418,7 +418,7 @@ export class Query { export class QuerySnapshot< T = DocumentData, - U extends DocumentData = DocumentData + T2 extends DocumentData = DocumentData > { private constructor(); @@ -442,7 +442,7 @@ export type DocumentChangeType = 'added' | 'removed' | 'modified'; export interface DocumentChange< T = DocumentData, - U extends DocumentData = DocumentData + T2 extends DocumentData = DocumentData > { readonly type: DocumentChangeType; readonly doc: QueryDocumentSnapshot; @@ -452,8 +452,8 @@ export interface DocumentChange< export class CollectionReference< T = DocumentData, - U extends DocumentData = DocumentData -> extends Query { + T2 extends DocumentData = DocumentData +> extends Query { private constructor(); readonly id: string;