diff --git a/dev/src/collection-group.ts b/dev/src/collection-group.ts index c53c2ebca..6ae784bd3 100644 --- a/dev/src/collection-group.ts +++ b/dev/src/collection-group.ts @@ -195,10 +195,16 @@ export class CollectionGroup< * converter. */ withConverter(converter: null): CollectionGroup; - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter ): CollectionGroup; - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter< NewAppModelType, NewDbModelType diff --git a/dev/src/index.ts b/dev/src/index.ts index 094b492d2..6448e475b 100644 --- a/dev/src/index.ts +++ b/dev/src/index.ts @@ -1286,11 +1286,12 @@ export class Firestore implements firestore.Firestore { * }); * ``` */ - getAll( + getAll( ...documentRefsOrReadOptions: Array< - firestore.DocumentReference | firestore.ReadOptions + | firestore.DocumentReference + | firestore.ReadOptions > - ): Promise> { + ): Promise>> { validateMinNumberOfArguments( 'Firestore.getAll', documentRefsOrReadOptions, diff --git a/dev/src/reference.ts b/dev/src/reference.ts index 852e10655..fb4c1738b 100644 --- a/dev/src/reference.ts +++ b/dev/src/reference.ts @@ -281,12 +281,7 @@ export class DocumentReference< * ``` */ get(): Promise> { - return this._firestore - .getAll(this as unknown as DocumentReference) - .then( - ([result]) => - result as unknown as DocumentSnapshot - ); + return this._firestore.getAll(this).then(([result]) => result); } /** @@ -621,7 +616,10 @@ export class DocumentReference< } withConverter(converter: null): DocumentReference; - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter ): DocumentReference; /** @@ -675,7 +673,10 @@ export class DocumentReference< * from Firestore. Passing in `null` removes the current converter. * @return A DocumentReference that uses the provided converter. */ - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter< NewAppModelType, NewDbModelType @@ -1330,7 +1331,10 @@ export class QueryOptions< ); } - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter ): QueryOptions { return new QueryOptions( @@ -2766,7 +2770,10 @@ export class Query< } withConverter(converter: null): Query; - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter ): Query; /** @@ -2819,7 +2826,10 @@ export class Query< * from Firestore. Passing in `null` removes the current converter. * @return A Query that uses the provided converter. */ - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter< NewAppModelType, NewDbModelType @@ -3095,7 +3105,10 @@ export class CollectionReference< } withConverter(converter: null): CollectionReference; - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter ): CollectionReference; /** @@ -3149,7 +3162,10 @@ export class CollectionReference< * from Firestore. Passing in `null` removes the current converter. * @return A CollectionReference that uses the provided converter. */ - withConverter( + withConverter< + NewAppModelType, + NewDbModelType extends firestore.DocumentData = firestore.DocumentData + >( converter: firestore.FirestoreDataConverter< NewAppModelType, NewDbModelType diff --git a/types/firestore.d.ts b/types/firestore.d.ts index cf57db042..9b6eab9e0 100644 --- a/types/firestore.d.ts +++ b/types/firestore.d.ts @@ -409,9 +409,11 @@ declare namespace FirebaseFirestore { * @return A Promise that resolves with an array of resulting document * snapshots. */ - getAll( - ...documentRefsOrReadOptions: Array - ): Promise>; + getAll( + ...documentRefsOrReadOptions: Array< + DocumentReference | ReadOptions + > + ): Promise>>; /** * Recursively deletes all documents and subcollections at and under the