From 12d6097289bdd7fef031d0db3c8258e219f8f904 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Fri, 2 Aug 2024 15:34:53 +1000 Subject: [PATCH] refactor(cli): use non-null assertion in `parseArgs()` logic (#5618) --- cli/parse_args.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cli/parse_args.ts b/cli/parse_args.ts index 47569bb82..ef7c756ae 100644 --- a/cli/parse_args.ts +++ b/cli/parse_args.ts @@ -374,8 +374,7 @@ function setNested( collect = false, ) { keys = [...keys]; - const key = keys.pop(); - if (!key) throw new Error(`'keys' cannot be an empty array.`); + const key = keys.pop()!; keys.forEach((key) => object = (object[key] ??= {}) as NestedMapping);