From 66e15d906b4d81df6940c6852808d388c5e6c425 Mon Sep 17 00:00:00 2001 From: Cynthia Date: Wed, 23 Nov 2022 21:40:21 +0100 Subject: [PATCH 1/3] fix: add options field to Command type declaration --- typings/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/typings/index.d.ts b/typings/index.d.ts index b69ea9104..f9ff94728 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -278,6 +278,7 @@ export class Command { args: string[]; processedArgs: any[]; commands: Command[]; + options: Option[]; parent: Command | null; constructor(name?: string); From 156cd50eea03c5f8e6a7a978a1181fd3b4dcb96a Mon Sep 17 00:00:00 2001 From: Cynthia Date: Sat, 26 Nov 2022 14:57:40 +0100 Subject: [PATCH 2/3] fix(typings)!: make commands and options readonly --- typings/index.d.ts | 4 ++-- typings/index.test-d.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index f9ff94728..6d16d42fb 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -277,8 +277,8 @@ export interface OptionValues { export class Command { args: string[]; processedArgs: any[]; - commands: Command[]; - options: Option[]; + readonly commands: Command[]; + readonly options: Option[]; parent: Command | null; constructor(name?: string); diff --git a/typings/index.test-d.ts b/typings/index.test-d.ts index 7b8af12ea..2d94f7e82 100644 --- a/typings/index.test-d.ts +++ b/typings/index.test-d.ts @@ -28,7 +28,8 @@ expectType(commander.createArgument('')); expectType(program.args); // eslint-disable-next-line @typescript-eslint/no-explicit-any expectType(program.processedArgs); -expectType(program.commands); +expectType>(program.commands); +expectType>(program.options); expectType(program.parent); // version From 3fde9150b1ff8260682cfcc745d26cd3db0ae4f2 Mon Sep 17 00:00:00 2001 From: Cynthia Date: Mon, 28 Nov 2022 12:53:58 +0100 Subject: [PATCH 3/3] fix(typings)!: properly mark arrays as readonly --- typings/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 6d16d42fb..876d30e91 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -277,8 +277,8 @@ export interface OptionValues { export class Command { args: string[]; processedArgs: any[]; - readonly commands: Command[]; - readonly options: Option[]; + readonly commands: readonly Command[]; + readonly options: readonly Option[]; parent: Command | null; constructor(name?: string);