|
1 |
| -import { InjectionToken, NgZone, NgModule, Optional } from '@angular/core'; |
2 |
| -import { app, auth, database, firestore, functions, messaging, storage } from 'firebase'; |
3 |
| -// @ts-ignore |
| 1 | +import { InjectionToken, NgModule, Optional } from '@angular/core'; |
| 2 | +import {app, auth, database, firestore, functions, messaging, storage } from 'firebase'; |
| 3 | +// @ts-ignore (https://github.com/firebase/firebase-js-sdk/pull/1206) |
4 | 4 | import firebase from 'firebase/app';
|
5 | 5 |
|
6 | 6 | // Public types don't expose FirebaseOptions or FirebaseAppConfig
|
@@ -36,9 +36,11 @@ export function _firebaseAppFactory(options: FirebaseOptions, nameOrConfig?: str
|
36 | 36 | const name = typeof nameOrConfig === 'string' && nameOrConfig || '[DEFAULT]';
|
37 | 37 | const config = typeof nameOrConfig === 'object' && nameOrConfig || {};
|
38 | 38 | config.name = config.name || name;
|
39 |
| - const existingApp = firebase.apps.filter(app => app && app.name === config.name)[0]; |
| 39 | + // Added any due to some inconsistency between @firebase/app and firebase types |
| 40 | + const existingApp = firebase.apps.filter(app => app && app.name === config.name)[0] as any; |
40 | 41 | // We support FirebaseConfig, initializeApp's public type only accepts string; need to cast as any
|
41 |
| - return (existingApp || firebase.initializeApp(options, config)) as FirebaseApp; |
| 42 | + // Should be solved with https://github.com/firebase/firebase-js-sdk/pull/1206 |
| 43 | + return (existingApp || firebase.initializeApp(options, config as any)) as FirebaseApp; |
42 | 44 | }
|
43 | 45 |
|
44 | 46 | const FirebaseAppProvider = {
|
|
0 commit comments