File tree Expand file tree Collapse file tree 5 files changed +19
-13
lines changed Expand file tree Collapse file tree 5 files changed +19
-13
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 @@ -284,10 +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 isn't used in INVALID_LOG_ARGUMENT error but ErrorFactory requires it
289
- appName : ''
290
- } ) ;
287
+ throw ERROR_FACTORY . create ( AppError . INVALID_LOG_ARGUMENT ) ;
291
288
}
292
289
setUserLogHandler ( logCallback , options ) ;
293
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 @@ -287,10 +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 isn't used in INVALID_LOG_ARGUMENT error but ErrorFactory requires it
292
- appName : ''
293
- } ) ;
290
+ throw ERROR_FACTORY . create ( AppError . INVALID_LOG_ARGUMENT ) ;
294
291
}
295
292
setUserLogHandler ( logCallback , options ) ;
296
293
}
You can’t perform that action at this time.
0 commit comments