@@ -31,8 +31,8 @@ function credentialFromResponse(
31
31
function attachExtraErrorFields ( auth : exp . Auth , e : FirebaseError ) : void {
32
32
// The response contains all fields from the server which may or may not
33
33
// actually match the underlying type
34
- const response = ( ( e . customData as exp . TaggedWithTokenResponse | undefined )
35
- ?. _tokenResponse as unknown ) as Record < string , string > ;
34
+ const response = ( e . customData as exp . TaggedWithTokenResponse | undefined )
35
+ ?. _tokenResponse as unknown as Record < string , string > ;
36
36
if ( e . code === 'auth/multi-factor-auth-required' ) {
37
37
const mfaErr = e as compat . MultiFactorError ;
38
38
mfaErr . resolver = new MultiFactorResolver (
@@ -54,9 +54,9 @@ function attachExtraErrorFields(auth: exp.Auth, e: FirebaseError): void {
54
54
function credentialFromObject (
55
55
object : FirebaseError | exp . UserCredential
56
56
) : exp . AuthCredential | null {
57
- const { _tokenResponse } = ( object instanceof FirebaseError
58
- ? object . customData
59
- : object ) as exp . TaggedWithTokenResponse ;
57
+ const { _tokenResponse } = (
58
+ object instanceof FirebaseError ? object . customData : object
59
+ ) as exp . TaggedWithTokenResponse ;
60
60
if ( ! _tokenResponse ) {
61
61
return null ;
62
62
}
@@ -142,26 +142,28 @@ export function convertCredential(
142
142
auth : exp . Auth ,
143
143
credentialPromise : Promise < exp . UserCredential >
144
144
) : Promise < compat . UserCredential > {
145
- return credentialPromise . catch ( e => {
146
- if ( e instanceof FirebaseError ) {
147
- attachExtraErrorFields ( auth , e ) ;
148
- }
149
- throw e ;
150
- } ) . then ( credential => {
151
- const operationType = credential . operationType ;
152
- const user = credential . user ;
153
-
154
- return {
155
- operationType,
156
- credential : credentialFromResponse (
157
- credential as exp . UserCredentialInternal
158
- ) ,
159
- additionalUserInfo : exp . getAdditionalUserInfo (
160
- credential as exp . UserCredential
161
- ) ,
162
- user : User . getOrCreate ( user )
163
- } ;
164
- } ) ;
145
+ return credentialPromise
146
+ . catch ( e => {
147
+ if ( e instanceof FirebaseError ) {
148
+ attachExtraErrorFields ( auth , e ) ;
149
+ }
150
+ throw e ;
151
+ } )
152
+ . then ( credential => {
153
+ const operationType = credential . operationType ;
154
+ const user = credential . user ;
155
+
156
+ return {
157
+ operationType,
158
+ credential : credentialFromResponse (
159
+ credential as exp . UserCredentialInternal
160
+ ) ,
161
+ additionalUserInfo : exp . getAdditionalUserInfo (
162
+ credential as exp . UserCredential
163
+ ) ,
164
+ user : User . getOrCreate ( user )
165
+ } ;
166
+ } ) ;
165
167
}
166
168
167
169
export async function convertConfirmationResult (
0 commit comments