-
Notifications
You must be signed in to change notification settings - Fork 928
Firebase 9 and Typescript typings error #4913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Yeah, The reason we export const enums instead of normal enums is because Typescript compiles normal enums to javascript in a way that makes them not tree shakable. That means all these enum objects will be included in your app even if you don't use them. One way we can solve it is to define these maps using plain javascript objects instead of typescript enums. |
That makes sense. I’ve set isolate modules to false; I can’t remember why I set it to true :-) |
@Feiyang1 Vite requires |
Opened an issue to track. |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
I am getting weird typing errors generated by the Typescript compiler that didn't happen with Firebase 8.
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1097:47 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
1097 static readonly FACEBOOK_SIGN_IN_METHOD = SignInMethod.FACEBOOK;
If I set isolatedModules to false in tsconfig.json, the errors go away.
I have upgraded to the latest version of Typescript (4.2.4) but it makes no difference.
This is the compiler output:
[17:20:25] Starting compilation in watch mode...
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:573:6 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
573 [AuthErrorCode.ARGUMENT_ERROR]: {
~~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:576:6 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
576 [AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]: {
~~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:579:6 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
579 [AuthErrorCode.INTERNAL_ERROR]: {
~~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:582:6 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
582 [AuthErrorCode.NO_AUTH_EVENT]: {
~~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:585:6 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
585 [AuthErrorCode.MFA_REQUIRED]: {
~~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:589:6 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
589 [AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]: {
~~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:965:35 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
965 static readonly PROVIDER_ID = ProviderId.PASSWORD;
~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:969:53 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
969 static readonly EMAIL_PASSWORD_SIGN_IN_METHOD = SignInMethod.EMAIL_PASSWORD;
~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:973:49 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
973 static readonly EMAIL_LINK_SIGN_IN_METHOD = SignInMethod.EMAIL_LINK;
~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:977:27 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
977 readonly providerId = ProviderId.PASSWORD;
~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1097:47 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
1097 static readonly FACEBOOK_SIGN_IN_METHOD = SignInMethod.FACEBOOK;
~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1099:35 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
1099 static readonly PROVIDER_ID = ProviderId.FACEBOOK;
~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1352:45 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
1352 static readonly GITHUB_SIGN_IN_METHOD = SignInMethod.GITHUB;
~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1354:35 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
1354 static readonly PROVIDER_ID = ProviderId.GITHUB;
~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1421:45 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
1421 static readonly GOOGLE_SIGN_IN_METHOD = SignInMethod.GOOGLE;
~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1423:35 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
1423 static readonly PROVIDER_ID = ProviderId.GOOGLE;
~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:2280:35 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
2280 static readonly PROVIDER_ID = ProviderId.PHONE;
~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:2282:44 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
2282 static readonly PHONE_SIGN_IN_METHOD = SignInMethod.PHONE;
~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:2284:27 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
2284 readonly providerId = ProviderId.PHONE;
~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:3206:46 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
3206 static readonly TWITTER_SIGN_IN_METHOD = SignInMethod.TWITTER;
~~~~~~~~~~~~
node_modules/@firebase/auth/dist/auth-exp-public.d.ts:3208:35 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.
3208 static readonly PROVIDER_ID = ProviderId.TWITTER;
~~~~~~~~~~
[17:20:33] Found 21 errors. Watching for file changes.
The text was updated successfully, but these errors were encountered: