Skip to content

Commit 6c4920f

Browse files
authored
overload user related functions (#4701)
1 parent 19c0c01 commit 6c4920f

File tree

3 files changed

+27
-48
lines changed

3 files changed

+27
-48
lines changed

packages-exp/auth-compat-exp/index.ts

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,7 @@ import {
2626
InstantiationMode
2727
} from '@firebase/component';
2828

29-
import {
30-
EmailAuthProvider,
31-
EmailAuthProvider_Instance,
32-
FacebookAuthProvider,
33-
FacebookAuthProvider_Instance,
34-
FirebaseAuth as AuthCompat,
35-
GithubAuthProvider,
36-
GithubAuthProvider_Instance,
37-
GoogleAuthProvider,
38-
GoogleAuthProvider_Instance,
39-
OAuthProvider,
40-
PhoneAuthProvider,
41-
PhoneAuthProvider_Instance,
42-
PhoneMultiFactorGenerator,
43-
RecaptchaVerifier,
44-
RecaptchaVerifier_Instance,
45-
SAMLAuthProvider,
46-
TwitterAuthProvider,
47-
TwitterAuthProvider_Instance
48-
} from '@firebase/auth-types';
29+
import * as types from '@firebase/auth-types';
4930
import { version } from './package.json';
5031
import { Auth } from './src/auth';
5132
import { Persistence } from './src/persistence';
@@ -56,36 +37,36 @@ const AUTH_TYPE = 'auth-compat';
5637

5738
declare module '@firebase/component' {
5839
interface NameServiceMapping {
59-
'auth-compat': AuthCompat;
40+
'auth-compat': types.FirebaseAuth;
6041
}
6142
}
6243

6344
declare module '@firebase/app-compat' {
6445
interface FirebaseNamespace {
6546
auth: {
66-
(app?: FirebaseApp): AuthCompat;
67-
Auth: typeof AuthCompat;
68-
EmailAuthProvider: typeof EmailAuthProvider;
69-
EmailAuthProvider_Instance: typeof EmailAuthProvider_Instance;
70-
FacebookAuthProvider: typeof FacebookAuthProvider;
71-
FacebookAuthProvider_Instance: typeof FacebookAuthProvider_Instance;
72-
GithubAuthProvider: typeof GithubAuthProvider;
73-
GithubAuthProvider_Instance: typeof GithubAuthProvider_Instance;
74-
GoogleAuthProvider: typeof GoogleAuthProvider;
75-
GoogleAuthProvider_Instance: typeof GoogleAuthProvider_Instance;
76-
OAuthProvider: typeof OAuthProvider;
77-
SAMLAuthProvider: typeof SAMLAuthProvider;
78-
PhoneAuthProvider: typeof PhoneAuthProvider;
79-
PhoneAuthProvider_Instance: typeof PhoneAuthProvider_Instance;
80-
PhoneMultiFactorGenerator: typeof PhoneMultiFactorGenerator;
81-
RecaptchaVerifier: typeof RecaptchaVerifier;
82-
RecaptchaVerifier_Instance: typeof RecaptchaVerifier_Instance;
83-
TwitterAuthProvider: typeof TwitterAuthProvider;
84-
TwitterAuthProvider_Instance: typeof TwitterAuthProvider_Instance;
47+
(app?: FirebaseApp): types.FirebaseAuth;
48+
Auth: typeof types.FirebaseAuth;
49+
EmailAuthProvider: typeof types.EmailAuthProvider;
50+
EmailAuthProvider_Instance: typeof types.EmailAuthProvider_Instance;
51+
FacebookAuthProvider: typeof types.FacebookAuthProvider;
52+
FacebookAuthProvider_Instance: typeof types.FacebookAuthProvider_Instance;
53+
GithubAuthProvider: typeof types.GithubAuthProvider;
54+
GithubAuthProvider_Instance: typeof types.GithubAuthProvider_Instance;
55+
GoogleAuthProvider: typeof types.GoogleAuthProvider;
56+
GoogleAuthProvider_Instance: typeof types.GoogleAuthProvider_Instance;
57+
OAuthProvider: typeof types.OAuthProvider;
58+
SAMLAuthProvider: typeof types.SAMLAuthProvider;
59+
PhoneAuthProvider: typeof types.PhoneAuthProvider;
60+
PhoneAuthProvider_Instance: typeof types.PhoneAuthProvider_Instance;
61+
PhoneMultiFactorGenerator: typeof types.PhoneMultiFactorGenerator;
62+
RecaptchaVerifier: typeof types.RecaptchaVerifier;
63+
RecaptchaVerifier_Instance: typeof types.RecaptchaVerifier_Instance;
64+
TwitterAuthProvider: typeof types.TwitterAuthProvider;
65+
TwitterAuthProvider_Instance: typeof types.TwitterAuthProvider_Instance;
8566
};
8667
}
8768
interface FirebaseApp {
88-
auth?(): AuthCompat;
69+
auth?(): types.FirebaseAuth;
8970
}
9071
}
9172

packages-exp/auth-compat-exp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration",
2828
"test:webdriver": "rollup -c test/integration/webdriver/static/rollup.config.js && ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --webdriver",
2929
"test:integration": "run-s test:browser:integration test:node:integration test:webdriver",
30-
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../auth-exp/dist/auth-exp-public.d.ts -o dist/auth-compat-exp/index.d.ts -a -r Auth:AuthCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/auth"
30+
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../auth-exp/dist/auth-exp-public.d.ts -o dist/auth-compat-exp/index.d.ts -a -r Auth:types.FirebaseAuth -r User:types.User -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/auth"
3131
},
3232
"peerDependencies": {
3333
"@firebase/app-compat": "0.x"

packages-exp/auth-exp/src/core/user/account_info.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ import { UserInternal } from '../../model/user';
2626
import { _logoutIfInvalidated } from './invalidation';
2727
import { getModularInstance } from '@firebase/util';
2828

29-
interface Profile {
30-
displayName?: string | null;
31-
photoURL?: string | null;
32-
}
33-
3429
/**
3530
* Updates a user's profile data.
3631
*
@@ -41,7 +36,10 @@ interface Profile {
4136
*/
4237
export async function updateProfile(
4338
user: User,
44-
{ displayName, photoURL: photoUrl }: Profile
39+
{
40+
displayName,
41+
photoURL: photoUrl
42+
}: { displayName?: string | null; photoURL?: string | null }
4543
): Promise<void> {
4644
if (displayName === undefined && photoUrl === undefined) {
4745
return;

0 commit comments

Comments
 (0)