@@ -33,7 +33,7 @@ export class StorageService extends Disposable implements IStorageService {
33
33
private _hasErrors = false ;
34
34
get hasErrors ( ) : boolean { return this . _hasErrors ; }
35
35
36
- private bufferedStorageErrors : ( string | Error ) [ ] = [ ] ;
36
+ private bufferedStorageErrors ? : ( string | Error ) [ ] = [ ] ;
37
37
private _onStorageError : Emitter < string | Error > = this . _register ( new Emitter < string | Error > ( ) ) ;
38
38
get onStorageError ( ) : Event < string | Error > {
39
39
if ( Array . isArray ( this . bufferedStorageErrors ) ) {
@@ -199,7 +199,7 @@ export class StorageService extends Disposable implements IStorageService {
199
199
} ) ;
200
200
201
201
console . group ( `Storage: Global (integrity: ${ result [ 2 ] } , load: ${ getDuration ( 'willInitGlobalStorage' , 'didInitGlobalStorage' ) } , path: ${ this . globalStorageWorkspacePath } )` ) ;
202
- let globalValues = [ ] ;
202
+ let globalValues : { key : string , value : string } [ ] = [ ] ;
203
203
globalItems . forEach ( ( value , key ) => {
204
204
globalValues . push ( { key, value } ) ;
205
205
} ) ;
@@ -209,7 +209,7 @@ export class StorageService extends Disposable implements IStorageService {
209
209
console . log ( globalItemsParsed ) ;
210
210
211
211
console . group ( `Storage: Workspace (integrity: ${ result [ 3 ] } , load: ${ getDuration ( 'willInitWorkspaceStorage' , 'didInitWorkspaceStorage' ) } , path: ${ this . workspaceStoragePath } )` ) ;
212
- let workspaceValues = [ ] ;
212
+ let workspaceValues : { key : string , value : string } [ ] = [ ] ;
213
213
workspaceItems . forEach ( ( value , key ) => {
214
214
workspaceValues . push ( { key, value } ) ;
215
215
} ) ;
@@ -295,7 +295,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
295
295
const globalKeyMarker = 'storage://global/' ;
296
296
297
297
window . addEventListener ( 'storage' , e => {
298
- if ( startsWith ( e . key , globalKeyMarker ) ) {
298
+ if ( e . key && startsWith ( e . key , globalKeyMarker ) ) {
299
299
const key = e . key . substr ( globalKeyMarker . length ) ;
300
300
301
301
this . _onDidChangeStorage . fire ( { key, scope : StorageScope . GLOBAL } ) ;
@@ -307,23 +307,26 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
307
307
return this . storageService as StorageService ;
308
308
}
309
309
310
- get ( key : string , scope : StorageScope , fallbackValue ?: string ) : string {
310
+ get ( key : string , scope : StorageScope , fallbackValue : string ) : string ;
311
+ get ( key : string , scope : StorageScope , fallbackValue ?: string ) : string | undefined {
311
312
if ( scope === StorageScope . WORKSPACE && ! this . useLegacyWorkspaceStorage ) {
312
313
return this . storageService . get ( key , scope , fallbackValue ) ;
313
314
}
314
315
315
316
return this . storageLegacyService . get ( key , this . convertScope ( scope ) , fallbackValue ) ;
316
317
}
317
318
318
- getBoolean ( key : string , scope : StorageScope , fallbackValue ?: boolean ) : boolean {
319
+ getBoolean ( key : string , scope : StorageScope , fallbackValue : boolean ) : boolean ;
320
+ getBoolean ( key : string , scope : StorageScope , fallbackValue ?: boolean ) : boolean | undefined {
319
321
if ( scope === StorageScope . WORKSPACE && ! this . useLegacyWorkspaceStorage ) {
320
322
return this . storageService . getBoolean ( key , scope , fallbackValue ) ;
321
323
}
322
324
323
325
return this . storageLegacyService . getBoolean ( key , this . convertScope ( scope ) , fallbackValue ) ;
324
326
}
325
327
326
- getInteger ( key : string , scope : StorageScope , fallbackValue ?: number ) : number {
328
+ getInteger ( key : string , scope : StorageScope , fallbackValue : number ) : number ;
329
+ getInteger ( key : string , scope : StorageScope , fallbackValue ?: number ) : number | undefined {
327
330
if ( scope === StorageScope . WORKSPACE && ! this . useLegacyWorkspaceStorage ) {
328
331
return this . storageService . getInteger ( key , scope , fallbackValue ) ;
329
332
}
0 commit comments