Skip to content

Firebase v9 typescript declaration file fails to compile with error TS1254 #5118

Closed
@prateekkumarweb

Description

@prateekkumarweb

[REQUIRED] Describe your environment

  • Operating System version: Ubuntu 20.04
  • Browser version: Chrome 91
  • Firebase SDK version: 9.0.0-beta.6
  • Firebase Product: auth

[REQUIRED] Describe the problem

Typescript compiler fails with an error TS1254

Steps to reproduce:

mkdir testapp
cd testapp
npm init
npm i -D typescript firebase@beta

Create index.ts file with following content:

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

On compiling, the error is:

$ npx tsc index.ts
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;
                                      ~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:985:53 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

985     static readonly EMAIL_PASSWORD_SIGN_IN_METHOD = SignInMethod.EMAIL_PASSWORD;
                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:989:49 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

989     static readonly EMAIL_LINK_SIGN_IN_METHOD = SignInMethod.EMAIL_LINK;
                                                    ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:993:27 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

993     readonly providerId = ProviderId.PASSWORD;
                              ~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1113:47 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

1113     static readonly FACEBOOK_SIGN_IN_METHOD = SignInMethod.FACEBOOK;
                                                   ~~~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1115:35 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

1115     static readonly PROVIDER_ID = ProviderId.FACEBOOK;
                                       ~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1368:45 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

1368     static readonly GITHUB_SIGN_IN_METHOD = SignInMethod.GITHUB;
                                                 ~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1370:35 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

1370     static readonly PROVIDER_ID = ProviderId.GITHUB;
                                       ~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1437:45 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

1437     static readonly GOOGLE_SIGN_IN_METHOD = SignInMethod.GOOGLE;
                                                 ~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1439:35 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

1439     static readonly PROVIDER_ID = ProviderId.GOOGLE;
                                       ~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:1491:18 - error TS2304: Cannot find name 'ProviderId_2'.

1491     providerId?: ProviderId_2 | string;
                      ~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:2296:35 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

2296     static readonly PROVIDER_ID = ProviderId.PHONE;
                                       ~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:2298:44 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

2298     static readonly PHONE_SIGN_IN_METHOD = SignInMethod.PHONE;
                                                ~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:2300:27 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

2300     readonly providerId = ProviderId.PHONE;
                               ~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:3220:46 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

3220     static readonly TWITTER_SIGN_IN_METHOD = SignInMethod.TWITTER;
                                                  ~~~~~~~~~~~~~~~~~~~~

node_modules/@firebase/auth/dist/auth-exp-public.d.ts:3222:35 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

3222     static readonly PROVIDER_ID = ProviderId.TWITTER;
                                       ~~~~~~~~~~~~~~~~~~


Found 16 errors.

Relevant Code:

See steps to reproduce

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions