Skip to content

Commit

Permalink
reference.ts: add default DocumentData parameter type for NewDbModelT…
Browse files Browse the repository at this point in the history
…ype to the other withConverter() functions
  • Loading branch information
dconeybe committed Sep 27, 2023
1 parent 3df89be commit e72d1df
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions packages/firestore/src/lite-api/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ export class DocumentReference<
* @param converter - Converts objects to and from Firestore.
* @returns A `DocumentReference` that uses the provided converter.
*/
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(
withConverter<
NewAppModelType,
NewDbModelType extends DocumentData = DocumentData
>(
converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>
): DocumentReference<NewAppModelType, NewDbModelType>;
/**
Expand All @@ -263,7 +266,10 @@ export class DocumentReference<
* use a converter.
*/
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(
withConverter<
NewAppModelType,
NewDbModelType extends DocumentData = DocumentData
>(
converter: FirestoreDataConverter<NewAppModelType, NewDbModelType> | null
): DocumentReference<NewAppModelType, NewDbModelType> {
return new DocumentReference<NewAppModelType, NewDbModelType>(
Expand Down Expand Up @@ -334,7 +340,10 @@ export class CollectionReference<
* @param converter - Converts objects to and from Firestore.
* @returns A `CollectionReference` that uses the provided converter.
*/
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(
withConverter<
NewAppModelType,
NewDbModelType extends DocumentData = DocumentData
>(
converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>
): CollectionReference<NewAppModelType, NewDbModelType>;
/**
Expand All @@ -347,7 +356,10 @@ export class CollectionReference<
withConverter(
converter: null
): CollectionReference<DocumentData, DocumentData>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(
withConverter<
NewAppModelType,
NewDbModelType extends DocumentData = DocumentData
>(
converter: FirestoreDataConverter<NewAppModelType, NewDbModelType> | null
): CollectionReference<NewAppModelType, NewDbModelType> {
return new CollectionReference<NewAppModelType, NewDbModelType>(
Expand Down

0 comments on commit e72d1df

Please sign in to comment.