From 04d161252fb2e3eb60a937e16448f372a351dc9f Mon Sep 17 00:00:00 2001
From: Sergei Zharinov <zharinov@users.noreply.github.com>
Date: Sun, 28 Nov 2021 15:54:46 +0300
Subject: [PATCH] refactor(config/global): Enable strict null checks (#12867)

* refactor(config/global): Enable strict null checks

* Fix inefficient copying

Co-authored-by: Rhys Arkins <rhys@arkins.net>
---
 lib/config/global.ts | 4 ++--
 tsconfig.strict.json | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/config/global.ts b/lib/config/global.ts
index 9a1b68f7fa..4c81facf97 100644
--- a/lib/config/global.ts
+++ b/lib/config/global.ts
@@ -2,7 +2,7 @@ import type { RenovateConfig, RepoGlobalConfig } from './types';
 
 export class GlobalConfig {
   // TODO: once global config work is complete, add a test to make sure this list includes all options with globalOnly=true (#9603)
-  private static readonly OPTIONS = [
+  private static readonly OPTIONS: (keyof RepoGlobalConfig)[] = [
     'allowCustomCrateRegistries',
     'allowedPostUpgradeCommands',
     'allowPlugins',
@@ -40,7 +40,7 @@ export class GlobalConfig {
 
     const result = { ...config };
     for (const option of GlobalConfig.OPTIONS) {
-      GlobalConfig.config[option] = config[option];
+      GlobalConfig.config[option] = config[option] as never;
       delete result[option];
     }
 
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index 546c9d9a86..151e37de1e 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -7,6 +7,7 @@
   },
   "files": [
     "./lib/config/app-strings.ts",
+    "./lib/config/global.ts",
     "./lib/config/migrations/types.ts",
     "./lib/config/presets/common.ts",
     "./lib/constants/error-messages.ts",
-- 
GitLab