mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-24 04:24:52 +08:00
[internals][types] Last part of internal refactor; Got rid of remaining flow errors
This commit is contained in:
@@ -29,7 +29,7 @@ import type {
|
||||
const FirebaseCoreModule = NativeModules.RNFirebase;
|
||||
|
||||
|
||||
export default class FirebaseApp {
|
||||
export default class App {
|
||||
_extendedProps: { [string] : boolean };
|
||||
_initialized: boolean = false;
|
||||
_name: string;
|
||||
@@ -119,6 +119,7 @@ export default class FirebaseApp {
|
||||
throw new Error(INTERNALS.STRINGS.ERROR_PROTECTED_PROP(key));
|
||||
}
|
||||
|
||||
// $FlowBug: Flow doesn't support indexable signatures on classes: https://github.com/facebook/flow/issues/1323
|
||||
this[key] = props[key];
|
||||
this._extendedProps[key] = true;
|
||||
}
|
||||
@@ -145,7 +146,7 @@ export default class FirebaseApp {
|
||||
*
|
||||
* @return {*}
|
||||
*/
|
||||
onReady(): Promise<FirebaseApp> {
|
||||
onReady(): Promise<App> {
|
||||
if (this._initialized) return Promise.resolve(this);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { NativeModules } from 'react-native';
|
||||
|
||||
import APPS from '../../utils/apps';
|
||||
import INTERNALS from '../../utils/internals';
|
||||
import FirebaseApp from './firebase-app';
|
||||
import App from './firebase-app';
|
||||
|
||||
// module imports
|
||||
import { statics as AdMobStatics, MODULE_NAME as AdmobModuleName } from '../admob';
|
||||
@@ -88,7 +88,7 @@ class FirebaseCore {
|
||||
* @param name
|
||||
* @return {*}
|
||||
*/
|
||||
initializeApp(options: FirebaseOptions, name: string): FirebaseApp {
|
||||
initializeApp(options: FirebaseOptions, name: string): App {
|
||||
return APPS.initializeApp(options, name);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class FirebaseCore {
|
||||
* @param name
|
||||
* @return {*}
|
||||
*/
|
||||
app(name?: string): FirebaseApp {
|
||||
app(name?: string): App {
|
||||
return APPS.app(name);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class FirebaseCore {
|
||||
* A (read-only) array of all initialized apps.
|
||||
* @return {Array}
|
||||
*/
|
||||
get apps(): Array<FirebaseApp> {
|
||||
get apps(): Array<App> {
|
||||
return APPS.apps();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user