File tree Expand file tree Collapse file tree 9 files changed +25
-15
lines changed Expand file tree Collapse file tree 9 files changed +25
-15
lines changed Original file line number Diff line number Diff line change 5
5
``` ts
6
6
7
7
import { Component } from ' @firebase/component' ;
8
- import { FirebaseApp } from ' @firebase/app-types' ;
9
- import { FirebaseAppConfig } from ' @firebase/app-types' ;
10
- import { FirebaseOptions } from ' @firebase/app-types' ;
8
+ import { FirebaseApp } from ' @firebase/app-types-exp ' ;
9
+ import { FirebaseAppConfig } from ' @firebase/app-types-exp ' ;
10
+ import { FirebaseOptions } from ' @firebase/app-types-exp ' ;
11
11
import { LogCallback } from ' @firebase/logger' ;
12
12
import { LogLevelString } from ' @firebase/logger' ;
13
13
import { LogOptions } from ' @firebase/logger' ;
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ export class FirebaseAppImpl implements FirebaseApp {
68
68
}
69
69
70
70
delete ( ) : Promise < void > {
71
- return new Promise ( resolve => {
71
+ return new Promise < void > ( resolve => {
72
72
this . app . checkDestroyed ( ) ;
73
73
resolve ( ) ;
74
74
} ) . then ( ( ) => {
Original file line number Diff line number Diff line change @@ -284,9 +284,7 @@ export function onLog(
284
284
options ?: LogOptions
285
285
) : void {
286
286
if ( logCallback !== null && typeof logCallback !== 'function' ) {
287
- throw ERROR_FACTORY . create ( AppError . INVALID_LOG_ARGUMENT , {
288
- appName : name
289
- } ) ;
287
+ throw ERROR_FACTORY . create ( AppError . INVALID_LOG_ARGUMENT ) ;
290
288
}
291
289
setUserLogHandler ( logCallback , options ) ;
292
290
}
Original file line number Diff line number Diff line change @@ -40,7 +40,13 @@ const ERRORS: ErrorMap<AppError> = {
40
40
'First argument to `onLog` must be null or a function.'
41
41
} ;
42
42
43
- type ErrorParams = { [ key in AppError ] : { appName : string } } ;
43
+ interface ErrorParams {
44
+ [ AppError . NO_APP ] : { appName : string } ;
45
+ [ AppError . BAD_APP_NAME ] : { appName : string } ;
46
+ [ AppError . DUPLICATE_APP ] : { appName : string } ;
47
+ [ AppError . APP_DELETED ] : { appName : string } ;
48
+ [ AppError . INVALID_APP_ARGUMENT ] : { appName : string } ;
49
+ }
44
50
45
51
export const ERROR_FACTORY = new ErrorFactory < AppError , ErrorParams > (
46
52
'app' ,
Original file line number Diff line number Diff line change @@ -40,7 +40,13 @@ const ERRORS: ErrorMap<AppError> = {
40
40
'First argument to `onLog` must be null or a function.'
41
41
} ;
42
42
43
- type ErrorParams = { [ key in AppError ] : { appName : string } } ;
43
+ interface ErrorParams {
44
+ [ AppError . NO_APP ] : { appName : string } ;
45
+ [ AppError . BAD_APP_NAME ] : { appName : string } ;
46
+ [ AppError . DUPLICATE_APP ] : { appName : string } ;
47
+ [ AppError . APP_DELETED ] : { appName : string } ;
48
+ [ AppError . INVALID_APP_ARGUMENT ] : { appName : string } ;
49
+ }
44
50
45
51
export const ERROR_FACTORY = new ErrorFactory < AppError , ErrorParams > (
46
52
'app' ,
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export class FirebaseAppImpl implements FirebaseApp {
86
86
}
87
87
88
88
delete ( ) : Promise < void > {
89
- return new Promise ( resolve => {
89
+ return new Promise < void > ( resolve => {
90
90
this . checkDestroyed_ ( ) ;
91
91
resolve ( ) ;
92
92
} )
Original file line number Diff line number Diff line change @@ -287,9 +287,7 @@ export function createFirebaseNamespaceCore(
287
287
288
288
function onLog ( logCallback : LogCallback | null , options ?: LogOptions ) : void {
289
289
if ( logCallback !== null && typeof logCallback !== 'function' ) {
290
- throw ERROR_FACTORY . create ( AppError . INVALID_LOG_ARGUMENT , {
291
- appName : name
292
- } ) ;
290
+ throw ERROR_FACTORY . create ( AppError . INVALID_LOG_ARGUMENT ) ;
293
291
}
294
292
setUserLogHandler ( logCallback , options ) ;
295
293
}
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ export class FirebaseAppLiteImpl implements FirebaseApp {
90
90
}
91
91
92
92
delete ( ) : Promise < void > {
93
- return new Promise ( resolve => {
93
+ return new Promise < void > ( resolve => {
94
94
this . checkDestroyed_ ( ) ;
95
95
resolve ( ) ;
96
96
} )
Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ export function createFirebaseNamespaceLite(): FirebaseNamespace {
48
48
component . name !== 'performance' &&
49
49
component . name !== 'installations'
50
50
) {
51
- throw Error ( `${ name } cannot register with the standalone perf instance` ) ;
51
+ throw Error (
52
+ `${ component . name } cannot register with the standalone perf instance`
53
+ ) ;
52
54
}
53
55
54
56
return registerComponent ( component ) ;
You can’t perform that action at this time.
0 commit comments