Skip to content

Commit 4e8ca3c

Browse files
author
Brian Chen
committed
go back to overloads instead of union
1 parent 390d49c commit 4e8ca3c

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

packages/firebase/index.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { DocumentData } from '@firebase/firestore-types';
18+
import {
19+
DocumentData,
20+
QueryDocumentSnapshot,
21+
SetOptions
22+
} from '@firebase/firestore-types';
1923

2024
/**
2125
* <code>firebase</code> is a global namespace from which all Firebase
@@ -7864,9 +7868,8 @@ declare namespace firebase.firestore {
78647868
* Firestore database). To use set() with `merge` and `mergeFields,
78657869
* toFirestore() must be defined with `Partial<T>`.
78667870
*/
7867-
toFirestore:
7868-
| ((modelObject: T) => DocumentData)
7869-
| ((modelObject: Partial<T>, options?: SetOptions) => DocumentData);
7871+
toFirestore(modelObject: T): DocumentData;
7872+
toFirestore(modelObject: Partial<T>, options: SetOptions): DocumentData;
78707873

78717874
/**
78727875
* Called by the Firestore SDK to convert Firestore data into an object of
@@ -7875,10 +7878,7 @@ declare namespace firebase.firestore {
78757878
* @param snapshot A QueryDocumentSnapshot containing your data and metadata.
78767879
* @param options The SnapshotOptions from the initial call to `data()`.
78777880
*/
7878-
fromFirestore: (
7879-
snapshot: QueryDocumentSnapshot,
7880-
options: SnapshotOptions
7881-
) => T;
7881+
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): T;
78827882
}
78837883

78847884
/**

packages/firestore-types/index.d.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,10 @@ export type LogLevel =
4949
export function setLogLevel(logLevel: LogLevel): void;
5050

5151
export interface FirestoreDataConverter<T> {
52-
toFirestore:
53-
| ((modelObject: T) => DocumentData)
54-
| ((modelObject: Partial<T>, options?: SetOptions) => DocumentData);
55-
56-
fromFirestore: (
57-
snapshot: QueryDocumentSnapshot,
58-
options: SnapshotOptions
59-
) => T;
52+
toFirestore(modelObject: T): DocumentData;
53+
toFirestore(modelObject: Partial<T>, options: SetOptions): DocumentData;
54+
55+
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): T;
6056
}
6157

6258
export class FirebaseFirestore {

0 commit comments

Comments
 (0)