From 9b5605773e0a8476a0b027625bb79a8edeaebe69 Mon Sep 17 00:00:00 2001 From: Dayoung Lee Date: Thu, 3 Nov 2022 17:40:48 +0900 Subject: [PATCH] [OneStorage] Clarify ConfigObjMaps value This commit removes null type from ConfigObjMap's value. Let's return undefined when the key is not found, as the same as the other maps do. ONE-vscode-DCO-1.0-Signed-off-by: Dayoung Lee --- src/OneExplorer/OneStorage.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/OneExplorer/OneStorage.ts b/src/OneExplorer/OneStorage.ts index b1c5d4c9..3b249838 100644 --- a/src/OneExplorer/OneStorage.ts +++ b/src/OneExplorer/OneStorage.ts @@ -29,7 +29,7 @@ interface StringListMap { } interface ConfigObjMap { - [key: string]: ConfigObj|null; + [key: string]: ConfigObj; } /** @@ -105,7 +105,10 @@ export class OneStorage { let map: ConfigObjMap = {}; cfgList.forEach(cfg => { - map[cfg] = ConfigObj.createConfigObj(vscode.Uri.file(cfg)); + const cfgObj = ConfigObj.createConfigObj(vscode.Uri.file(cfg)); + if (cfgObj) { + map[cfg] = cfgObj; + } }); return map; @@ -171,7 +174,7 @@ export class OneStorage { /** * Get cfgObj from the map */ - public static getCfgObj(cfgPath: string): ConfigObj|null { + public static getCfgObj(cfgPath: string): ConfigObj|undefined { return OneStorage.get()._cfgToCfgObjMap[cfgPath]; }