@@ -579,10 +579,7 @@ export class DocumentSnapshot<
579579 * @returns an instance of {@link DocumentSnapshot} if the JSON object could be
580580 * parsed. Throws a {@link FirestoreError} if an error occurs.
581581 */
582- static fromJSON ( db : Firestore , json : object ) : DocumentSnapshot {
583- return DocumentSnapshot . fromJSONInternal ( db , json , /* converter = */ null ) ;
584- }
585-
582+ static fromJSON ( db : Firestore , json : object ) : DocumentSnapshot ;
586583 /**
587584 * Builds a `DocumentSnapshot` instance from a JSON object created by
588585 * {@link DocumentSnapshot.toJSON}.
@@ -593,29 +590,21 @@ export class DocumentSnapshot<
593590 * @returns an instance of {@link DocumentSnapshot} if the JSON object could be
594591 * parsed. Throws a {@link FirestoreError} if an error occurs.
595592 */
596- static fromJSONUsingConverter <
593+ static fromJSON <
597594 AppModelType ,
598595 DbModelType extends DocumentData = DocumentData
599596 > (
600597 db : Firestore ,
601598 json : object ,
602599 converter : FirestoreDataConverter < AppModelType , DbModelType >
603- ) : DocumentSnapshot < AppModelType , DbModelType > {
604- return DocumentSnapshot . fromJSONInternal ( db , json , converter ) ;
605- }
606-
607- /**
608- * Internal implementation for 'fromJSON' and 'fromJSONUsingCoverter'.
609- * @internal
610- * @private
611- */
612- private static fromJSONInternal <
600+ ) : DocumentSnapshot < AppModelType , DbModelType > ;
601+ static fromJSON <
613602 AppModelType ,
614603 DbModelType extends DocumentData = DocumentData
615604 > (
616605 db : Firestore ,
617606 json : object ,
618- converter : FirestoreDataConverter < AppModelType , DbModelType > | null = null
607+ ... args : unknown [ ]
619608 ) : DocumentSnapshot < AppModelType , DbModelType > {
620609 if ( validateJSON ( json , DocumentSnapshot . _jsonSchema ) ) {
621610 // Parse the bundle data.
@@ -645,6 +634,15 @@ export class DocumentSnapshot<
645634 ResourcePath . fromString ( json . bundleName )
646635 ) ;
647636
637+ let converter : FirestoreDataConverter < AppModelType , DbModelType > | null =
638+ null ;
639+ if ( args [ 0 ] ) {
640+ converter = args [ 0 ] as FirestoreDataConverter <
641+ AppModelType ,
642+ DbModelType
643+ > ;
644+ }
645+
648646 // Return the external facing DocumentSnapshot.
649647 return new DocumentSnapshot (
650648 db ,
@@ -891,9 +889,7 @@ export class QuerySnapshot<
891889 * @returns an instance of {@link QuerySnapshot} if the JSON object could be
892890 * parsed. Throws a {@link FirestoreError} if an error occurs.
893891 */
894- static fromJSON ( db : Firestore , json : object ) : QuerySnapshot {
895- return QuerySnapshot . fromJSONInternal ( db , json , /* converter = */ null ) ;
896- }
892+ static fromJSON ( db : Firestore , json : object ) : QuerySnapshot ;
897893
898894 /**
899895 * Builds a `QuerySnapshot` instance from a JSON object created by
@@ -905,29 +901,18 @@ export class QuerySnapshot<
905901 * @returns an instance of {@link QuerySnapshot} if the JSON object could be
906902 * parsed. Throws a {@link FirestoreError} if an error occurs.
907903 */
908- static fromJSONUsingConverter <
904+ static fromJSON <
909905 AppModelType ,
910906 DbModelType extends DocumentData = DocumentData
911907 > (
912908 db : Firestore ,
913909 json : object ,
914910 converter : FirestoreDataConverter < AppModelType , DbModelType >
915- ) : QuerySnapshot < AppModelType , DbModelType > {
916- return QuerySnapshot . fromJSONInternal ( db , json , converter ) ;
917- }
918-
919- /**
920- * Internal implementation for 'fromJSON' and 'fromJSONUsingCoverter'.
921- * @internal
922- * @private
923- */
924- private static fromJSONInternal <
925- AppModelType ,
926- DbModelType extends DocumentData = DocumentData
927- > (
911+ ) : QuerySnapshot < AppModelType , DbModelType > ;
912+ static fromJSON < AppModelType , DbModelType extends DocumentData > (
928913 db : Firestore ,
929914 json : object ,
930- converter : FirestoreDataConverter < AppModelType , DbModelType > | null
915+ ... args : unknown [ ]
931916 ) : QuerySnapshot < AppModelType , DbModelType > {
932917 if ( validateJSON ( json , QuerySnapshot . _jsonSchema ) ) {
933918 // Parse the bundle data.
@@ -968,6 +953,15 @@ export class QuerySnapshot<
968953 /* hasCachedResults= */ false
969954 ) ;
970955
956+ let converter : FirestoreDataConverter < AppModelType , DbModelType > | null =
957+ null ;
958+ if ( args [ 0 ] ) {
959+ converter = args [ 0 ] as FirestoreDataConverter <
960+ AppModelType ,
961+ DbModelType
962+ > ;
963+ }
964+
971965 // Create an external Query object, required to construct the QuerySnapshot.
972966 const externalQuery = new Query < AppModelType , DbModelType > (
973967 db ,
0 commit comments