Skip to content

Auth package triggers errors (TS1254, TS2304) in version 9-beta 6 #5181

@ghost

Description

Description of the Issue
There seems to be a problem with the typings in @firebase/auth/dist/auth-exp-public.d.ts. On a freshly created Angular app I'm getting the following error trying to import any function from firebase/auth:

Error: node_modules/@firebase/auth/dist/auth-exp-public.d.ts:981:35
error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.
981     static readonly PROVIDER_ID = ProviderId.PASSWORD;
985     static readonly EMAIL_PASSWORD_SIGN_IN_METHOD = SignInMethod.EMAIL_PASSWORD;
989     static readonly EMAIL_LINK_SIGN_IN_METHOD = SignInMethod.EMAIL_LINK;
993     readonly providerId = ProviderId.PASSWORD;
1113     static readonly FACEBOOK_SIGN_IN_METHOD = SignInMethod.FACEBOOK;
1115     static readonly PROVIDER_ID = ProviderId.FACEBOOK;
1368     static readonly GITHUB_SIGN_IN_METHOD = SignInMethod.GITHUB;
1370     static readonly PROVIDER_ID = ProviderId.GITHUB;
1437     static readonly GOOGLE_SIGN_IN_METHOD = SignInMethod.GOOGLE;
1439     static readonly PROVIDER_ID = ProviderId.GOOGLE;
2296     static readonly PROVIDER_ID = ProviderId.PHONE;
2298     static readonly PHONE_SIGN_IN_METHOD = SignInMethod.PHONE;
2300     readonly providerId = ProviderId.PHONE;
3220     static readonly TWITTER_SIGN_IN_METHOD = SignInMethod.TWITTER;
3222     static readonly PROVIDER_ID = ProviderId.TWITTER;

Error: node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1491:18
error TS2304: Cannot find name 'ProviderId_2'.
1491     providerId?: ProviderId_2 | string;

Related Issues
I could only find this issue (beta-1) #4853.

Environment Configuration

Firebase JS SDK: 9.0.0-beta.6
Angular CLI: 12.1.2
Node: 14.17.3
Package Manager: npm 7.20.0
OS: darwin x64
Java: 1.8.0_291
Yarn: 1.22.10

Reproduce the Error

  • create an Angular app with ng new
  • call initializeApp
  • import anything from firebase/auth

Example code

// app.component.ts
import { Component } from '@angular/core';

import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';


@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss'],
})
export class AppComponent {
  constructor() {

    const firebaseConfig = { ... }
    const app: FirebaseApp = initializeApp(firebaseConfig);
    console.log(app)

  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions