From 743b78002d0d6daa4e2814c4114962d7cb7eb644 Mon Sep 17 00:00:00 2001 From: Pablion <36828324+Pablion@users.noreply.github.com> Date: Sun, 10 Oct 2021 16:52:13 +0200 Subject: [PATCH 1/3] Fix AuthError incoherent structure. Add a AuthErrorData interface for customData in `FirebaseError` Change tenantid to tenantId, other tenantId are formatted like this, better than smallcase since ID is a "word" --- packages/auth/src/model/public_types.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/auth/src/model/public_types.ts b/packages/auth/src/model/public_types.ts index 92adb411a0c..c66fdb8fd5b 100644 --- a/packages/auth/src/model/public_types.ts +++ b/packages/auth/src/model/public_types.ts @@ -116,11 +116,12 @@ export interface ParsedToken { export type NextOrObserver = NextFn | Observer; /** - * Interface for an `Auth` error. - * + * customData for AuthError + * * @public */ -export interface AuthError extends FirebaseError { +export declare interface AuthErrorData + extends Record { /** The name of the Firebase App which triggered this error. */ readonly appName: string; /** The email of the user's account, used for sign-in/linking. */ @@ -135,7 +136,17 @@ export interface AuthError extends FirebaseError { * you have to set the tenant ID on {@link Auth} instance again as the tenant ID is not persisted * after redirection. */ - readonly tenantid?: string; + readonly tenantId?: string; // other tenantId are formatted like this. And It's better than smallcase since ID is a "word" +} + +/** + * Interface for an `Auth` error. + * + * @public + */ +export declare interface AuthError extends FirebaseError { + /** The detailed Data of the Firebase Auth error. */ + readonly customData: AuthErrorData; } /** From 1ffcad214329a0602ba0c00ff6909d9050eccb5c Mon Sep 17 00:00:00 2001 From: Pablion <36828324+Pablion@users.noreply.github.com> Date: Tue, 12 Oct 2021 05:45:38 +0200 Subject: [PATCH 2/3] change field type customData to inlined style In this way `extends Record` is discarded. --- packages/auth/src/model/public_types.ts | 43 ++++++++++--------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/packages/auth/src/model/public_types.ts b/packages/auth/src/model/public_types.ts index c66fdb8fd5b..c1e691e0fda 100644 --- a/packages/auth/src/model/public_types.ts +++ b/packages/auth/src/model/public_types.ts @@ -115,30 +115,6 @@ export interface ParsedToken { */ export type NextOrObserver = NextFn | Observer; -/** - * customData for AuthError - * - * @public - */ -export declare interface AuthErrorData - extends Record { - /** The name of the Firebase App which triggered this error. */ - readonly appName: string; - /** The email of the user's account, used for sign-in/linking. */ - readonly email?: string; - /** The phone number of the user's account, used for sign-in/linking. */ - readonly phoneNumber?: string; - /** - * The tenant ID being used for sign-in/linking. - * - * @remarks - * If you use {@link signInWithRedirect} to sign in, - * you have to set the tenant ID on {@link Auth} instance again as the tenant ID is not persisted - * after redirection. - */ - readonly tenantId?: string; // other tenantId are formatted like this. And It's better than smallcase since ID is a "word" -} - /** * Interface for an `Auth` error. * @@ -146,8 +122,23 @@ export declare interface AuthErrorData */ export declare interface AuthError extends FirebaseError { /** The detailed Data of the Firebase Auth error. */ - readonly customData: AuthErrorData; -} + readonly customData: { + /** The name of the Firebase App which triggered this error. */ + readonly appName: string; + /** The email of the user's account, used for sign-in/linking. */ + readonly email?: string; + /** The phone number of the user's account, used for sign-in/linking. */ + readonly phoneNumber?: string; + /** + * The tenant ID being used for sign-in/linking. + * + * @remarks + * If you use {@link signInWithRedirect} to sign in, + * you have to set the tenant ID on {@link Auth} instance again as the tenant ID is not persisted + * after redirection. + */ + readonly tenantId?: string; + };} /** * Interface representing an {@link Auth} instance's settings. From a17629faeec76c1dc194448a5fa8a0abee33f2d8 Mon Sep 17 00:00:00 2001 From: Pablion <36828324+Pablion@users.noreply.github.com> Date: Wed, 13 Oct 2021 00:08:20 +0200 Subject: [PATCH 3/3] chore: Imporve formatting --- packages/auth/src/model/public_types.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/auth/src/model/public_types.ts b/packages/auth/src/model/public_types.ts index c1e691e0fda..251e0ffc28f 100644 --- a/packages/auth/src/model/public_types.ts +++ b/packages/auth/src/model/public_types.ts @@ -117,7 +117,8 @@ export type NextOrObserver = NextFn | Observer; /** * Interface for an `Auth` error. - * + * + * * @public */ export declare interface AuthError extends FirebaseError { @@ -138,7 +139,8 @@ export declare interface AuthError extends FirebaseError { * after redirection. */ readonly tenantId?: string; - };} + }; +} /** * Interface representing an {@link Auth} instance's settings.