diff --git a/src/Common/Splitter.ts b/src/Common/Splitter.ts index 823a88f99..5699247f1 100644 --- a/src/Common/Splitter.ts +++ b/src/Common/Splitter.ts @@ -23,10 +23,10 @@ export class Splitter { public splitterId: string; public leftSideId: string; - public splitter: HTMLElement; - public leftSide: HTMLElement; - public lastX: number; - public lastWidth: number; + public splitter!: HTMLElement; + public leftSide!: HTMLElement; + public lastX!: number; + public lastWidth!: number; private isCollapsed: ko.Observable; private bounds: SplitterBounds; @@ -42,9 +42,10 @@ export class Splitter { } public initialize() { - this.splitter = document.getElementById(this.splitterId); - this.leftSide = document.getElementById(this.leftSideId); - + if (document.getElementById(this.splitterId) !== null && document.getElementById(this.leftSideId) != null) { + this.splitter = document.getElementById(this.splitterId); + this.leftSide = document.getElementById(this.leftSideId); + } const isVerticalSplitter: boolean = this.direction === SplitterDirection.Vertical; const splitterOptions: JQueryUI.ResizableOptions = { animate: true, diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap index 00c1cda45..2075134f6 100644 --- a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap +++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap @@ -1180,11 +1180,9 @@ exports[`SettingsComponent renders 1`] = ` }, "direction": "vertical", "isCollapsed": [Function], - "leftSide": null, "leftSideId": "resourcetree", "onResizeStart": [Function], "onResizeStop": [Function], - "splitter": null, "splitterId": "h_splitter1", }, "stringInputPane": StringInputPane { @@ -2456,11 +2454,9 @@ exports[`SettingsComponent renders 1`] = ` }, "direction": "vertical", "isCollapsed": [Function], - "leftSide": null, "leftSideId": "resourcetree", "onResizeStart": [Function], "onResizeStop": [Function], - "splitter": null, "splitterId": "h_splitter1", }, "stringInputPane": StringInputPane { @@ -3745,11 +3741,9 @@ exports[`SettingsComponent renders 1`] = ` }, "direction": "vertical", "isCollapsed": [Function], - "leftSide": null, "leftSideId": "resourcetree", "onResizeStart": [Function], "onResizeStop": [Function], - "splitter": null, "splitterId": "h_splitter1", }, "stringInputPane": StringInputPane { @@ -5021,11 +5015,9 @@ exports[`SettingsComponent renders 1`] = ` }, "direction": "vertical", "isCollapsed": [Function], - "leftSide": null, "leftSideId": "resourcetree", "onResizeStart": [Function], "onResizeStop": [Function], - "splitter": null, "splitterId": "h_splitter1", }, "stringInputPane": StringInputPane { diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 03eb9e492..9042b7300 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -22,7 +22,8 @@ "./src/Common/MongoUtility.ts", "./src/Common/ObjectCache.ts", "./src/Common/ThemeUtility.ts", - "./src/Common/UrlUtility.ts", + "./src/Common/UrlUtility.ts", + "./src/Common/Splitter.ts", "./src/ConfigContext.ts", "./src/Contracts/ActionContracts.ts", "./src/Contracts/DataModels.ts",