1
votes

In an Angular2 / TypeScript environment, the following code from Firebase documentation errors with "EmailPasswordAuthProvider Does Not Exist on Type Auth".

var credential = firebase.auth.EmailPasswordAuthProvider.credential(email, password);

https://firebase.google.com/docs/auth/web/anonymous-auth Convert an anonymous account to a permanent account

Have installed the latest Firebase typings version: [email protected]

Note that other Firebase methods are working okay and that the auth object requires the open/close brackets e.g.

firebase.auth().createUserWithEmailAndPassword(email, password);
2
I get the same error when using method: EmailAuthProvider Note that I'm following the web implementation documentation.Aydus-Matthew

2 Answers

5
votes

this is a bug in the typescript definitions. The Firebase team has been notified and is working on a fix. In the meantime use the following workaround:

(<any> firebase.auth.EmailAuthProvider).credential 
0
votes

There is my temporary solution:

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

const credential = firebase.default.auth.EmailAuthProvider.credential(email, pass);