Firebase-js-sdk: app(types): firebase.auth.AuthCredential from firebase/app/index.d.ts missing signInMethod field

Created on 21 Mar 2018  路  5Comments  路  Source: firebase/firebase-js-sdk

[REQUIRED] Describe your environment

  • Operating System version: 10.13.3
  • Firebase SDK version: 4.12.0
  • Firebase Product: auth

[REQUIRED] Describe the problem

PR https://github.com/firebase/firebase-js-sdk/pull/529 should have also updated https://github.com/firebase/firebase-js-sdk/blob/d59b72493fc89ff89c8a17bf142f58517de4c566/packages/firebase/app/index.d.ts#L204-L206 to add the signInMethod: string; field.

This was done in some places, but not all of them
https://github.com/firebase/firebase-js-sdk/blob/a3c6335deedc99a4532d0fe01406241cdb2b88c1/packages/auth-types/index.d.ts#L97-L100

Steps to reproduce:

Upgrade firebase from 4.11.0 to 4.12.0 and @firebase/auth from 0.3.4 to 0.4.0.

ERROR in src/app/users.service.ts(191,43): error TS2345: Argument of type 'firebase.auth.AuthCredential' is not assignable to parameter of type 'AuthCredential'.
  Property 'signInMethod' is missing in type 'AuthCredential'.

Relevant Code:

import * as firebase from 'firebase/app';
...

  signInWithCredential(credential: firebase.auth.AuthCredential): void {
    this.fbAuth.auth.signInWithCredential(credential) <-- this argument's type causes the error
...

Workaround

My IDE doesn't present this as an option, but removing firebase.auth from the first use of the type and adding the following import, seems to solve the error.

import {AuthCredential} from '@firebase/auth-types';
auth

Most helpful comment

@Splaktar Thanks for reporting this. I have a fix in PR #583. But unfortunately you'll have to wait until next week's release to use it. Sorry for the inconvenience.

All 5 comments

@Splaktar Thanks for reporting this. I have a fix in PR #583. But unfortunately you'll have to wait until next week's release to use it. Sorry for the inconvenience.

No problem. The workaround is working for me. Hopefully not many others will hit it between now and the new release 馃槃

Hello! I've hit said wall. Does anyone know if this has been fixed? Also, @Splaktar can you elaborate a little more on your workaround?

@TheCorbin here's the exact steps that I used for the workaround:

Change this

import * as firebase from 'firebase/app';
...
  signInWithCredential(credential: firebase.auth.AuthCredential): void {
    this.fbAuth.auth.signInWithCredential(credential)
...

To this

import * as firebase from 'firebase/app';
import {AuthCredential} from '@firebase/auth-types';
...
  signInWithCredential(credential: AuthCredential): void {
    this.fbAuth.auth.signInWithCredential(credential)
...

@TheCorbin this was fixed in [email protected].

Was this page helpful?
0 / 5 - 0 ratings