From bd0402081b10937842bd214a2956bf82569a086a Mon Sep 17 00:00:00 2001 From: Tristan Chuine Date: Wed, 17 Jul 2024 16:17:06 +0200 Subject: [PATCH] review Signed-off-by: Tristan Chuine --- demo/src/diagram-viewers/add-diagrams.ts | 15 +++++++-------- demo/src/index.tsx | 3 +-- .../network-map-viewer/network/network-map.d.ts | 2 +- .../single-line-diagram-viewer.ts | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/demo/src/diagram-viewers/add-diagrams.ts b/demo/src/diagram-viewers/add-diagrams.ts index e6dcc7bb..335ccc16 100644 --- a/demo/src/diagram-viewers/add-diagrams.ts +++ b/demo/src/diagram-viewers/add-diagrams.ts @@ -26,8 +26,7 @@ export const addNadToDemo = () => { .then((response) => response.text()) .then((svgContent) => { new NetworkAreaDiagramViewer( - // @ts-expect-error: we know it's not null in the demo - document.getElementById('svg-container'), + document.getElementById('svg-container')!, svgContent, 500, 600, @@ -47,8 +46,7 @@ export const addSldToDemo = () => { .then((response) => response.text()) .then((svgContent) => { new SingleLineDiagramViewer( - // @ts-expect-error: we know it's not null in the demo - document.getElementById('svg-container-sld'), + document.getElementById('svg-container-sld')!, svgContent, //svg content null, //svg metadata 'voltage-level', @@ -60,6 +58,7 @@ export const addSldToDemo = () => { null, //callback on the breakers null, //callback on the feeders null, //callback on the buses + // @ts-expect-error: TODO look if null is really possible in code null, //arrows color null //hovers on equipments callback ); @@ -74,9 +73,9 @@ export const addSldToDemo = () => { .then((response) => response.text()) .then((svgContent) => { new SingleLineDiagramViewer( - // @ts-expect-error: we know it's not null in the demo - document.getElementById('svg-container-sld-with-callbacks'), + document.getElementById('svg-container-sld-with-callbacks')!, svgContent, //svg content + // @ts-expect-error: incomplete data in example json SldSvgExampleMeta, //svg metadata 'voltage-level', 500, @@ -101,9 +100,9 @@ export const addSldToDemo = () => { .then((response) => response.text()) .then((svgContent) => { new SingleLineDiagramViewer( - // @ts-expect-error: we know it's not null in the demo - document.getElementById('svg-container-sldsub-with-callbacks'), + document.getElementById('svg-container-sldsub-with-callbacks')!, svgContent, //svg content + // @ts-expect-error: incomplete data in example json SldSvgSubExampleMeta, //svg metadata 'substation', 500, diff --git a/demo/src/index.tsx b/demo/src/index.tsx index 6fbea5a1..ae3b8d65 100644 --- a/demo/src/index.tsx +++ b/demo/src/index.tsx @@ -9,8 +9,7 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; -// @ts-expect-error: not null in this demo -const root = ReactDOM.createRoot(document.getElementById('root')); +const root = ReactDOM.createRoot(document.getElementById('root')!); root.render( diff --git a/src/components/network-map-viewer/network/network-map.d.ts b/src/components/network-map-viewer/network/network-map.d.ts index e9ab0231..d9531128 100644 --- a/src/components/network-map-viewer/network/network-map.d.ts +++ b/src/components/network-map-viewer/network/network-map.d.ts @@ -71,7 +71,7 @@ type NetworkMapProps = { // resized, but not for programmatic resizes of the parent. For now in our // app, only study display mode resizes programmatically // use this prop to make the map resize when needed, each time this prop changes, map.resize() is trigged - triggerMapResizeOnChange: unknown; + triggerMapResizeOnChange?: unknown; updatedLines?: LineLayerProps['updatedLines']; useName?: boolean; visible?: boolean; diff --git a/src/components/single-line-diagram-viewer/single-line-diagram-viewer.ts b/src/components/single-line-diagram-viewer/single-line-diagram-viewer.ts index 1a6ffb53..d33ef88c 100644 --- a/src/components/single-line-diagram-viewer/single-line-diagram-viewer.ts +++ b/src/components/single-line-diagram-viewer/single-line-diagram-viewer.ts @@ -149,7 +149,7 @@ export class SingleLineDiagramViewer { onFeederCallback: OnFeederCallbackType | null, onBusCallback: OnBusCallbackType | null, selectionBackColor: string, - handleTogglePopover: HandleTogglePopoverType + handleTogglePopover: HandleTogglePopoverType | null ) { this.container = container; this.svgType = svgType;