Aydus-Matthew Aydus-Matthew - 1 year ago 190
TypeScript Question

Firebase EmailPasswordAuthProvider Does Not Exist on Type Auth

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);

Convert an anonymous account to a permanent account

Have installed the latest Firebase typings version: firebase@3.0.5

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);

Answer Source

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