From 3c7725ae65e1c8455508a4ca90e8e38214560a3e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 28 Apr 2023 10:38:45 +0100 Subject: [PATCH] Conform to Typescript `strict` mode --- src/ModuleApi.ts | 5 +++-- src/components/DialogContent.tsx | 2 +- test/lifecycles/WidgetLifecycle.test.ts | 2 +- tsconfig.json | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ModuleApi.ts b/src/ModuleApi.ts index 93ca7a1..88384ee 100644 --- a/src/ModuleApi.ts +++ b/src/ModuleApi.ts @@ -92,7 +92,8 @@ export interface ModuleApi { /** * Gets a value verbatim from the config. The returned value will be of the type specified - * by the user - it is not verified against a schema. + * by the user - it is not verified against a schema. If the value does not exist in the + * config then this will return undefined; * * The caller should provide a namespace which it owns to retrieve settings from. During * read, the `key` will be treated as a sub-key of the namespace on the overall configuration @@ -115,5 +116,5 @@ export interface ModuleApi { * @param key The key to look up. * @returns The config value verbatim. */ - getConfigValue(namespace: string, key: string): T; + getConfigValue(namespace: string, key: string): T | undefined; } diff --git a/src/components/DialogContent.tsx b/src/components/DialogContent.tsx index cf3152e..196c1ce 100644 --- a/src/components/DialogContent.tsx +++ b/src/components/DialogContent.tsx @@ -36,7 +36,7 @@ export abstract class DialogContent

{ beforeAll(() => { module = new class extends RuntimeModule { constructor() { - super(undefined); + super(undefined as any); this.on(WidgetLifecycle.CapabilitiesRequest, this.capabilitiesListener); this.on(WidgetLifecycle.PreLoadRequest, this.preloadListener); diff --git a/tsconfig.json b/tsconfig.json index b52c58b..cb79df3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,10 +5,10 @@ "esModuleInterop": true, "module": "commonjs", "moduleResolution": "node", - "noImplicitAny": true, "declaration": false, "noEmit": true, - "jsx": "react" + "jsx": "react", + "strict": true }, "include": [ "./src/**/*.ts",