From 60a67a6522223a0c34802d245befb62a343376f0 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 29 Jul 2022 18:57:14 +0300 Subject: [PATCH] type fixes --- src/classes/CommandOption.ts | 6 +++++- src/interfaces/CommandOption.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/classes/CommandOption.ts b/src/classes/CommandOption.ts index 4b41022..173b9bb 100644 --- a/src/classes/CommandOption.ts +++ b/src/classes/CommandOption.ts @@ -49,7 +49,11 @@ class CommandOption implements ICommandOption { this.name = def.name; this.aliases = def.aliases || []; - this.options = def.options || []; + this.options = []; + for (const opt of def.options || []) { + if (opt instanceof CommandOption) this.options.push(opt); + else this.options.push(new CommandOption(opt)); + } this.choices = def.choices || []; this.strict = def.strict || false; diff --git a/src/interfaces/CommandOption.ts b/src/interfaces/CommandOption.ts index cd40806..3c3561e 100644 --- a/src/interfaces/CommandOption.ts +++ b/src/interfaces/CommandOption.ts @@ -72,7 +72,7 @@ type CommandOptionDefinition = { name: string; aliases?: string[]; // eslint-disable-next-line no-use-before-define - options?: CommandOption[]; + options?: (CommandOption|CommandOptionDefinition)[]; type?: OptionType; strict?: boolean