From a96341f7c0caf5932666cabac46e2f9d64313229 Mon Sep 17 00:00:00 2001 From: Michael Molisani Date: Sat, 19 Oct 2024 15:40:30 -0400 Subject: [PATCH] fix: export constituent types of TypedCommandParameters individually Signed-off-by: Michael Molisani --- packages/core/src/index.ts | 8 +++++++- packages/core/src/parameter/types.ts | 18 +++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 6e263b9..6ef5225 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -48,7 +48,13 @@ export { UnsatisfiedPositionalError, formatMessageForArgumentScannerError, } from "./parameter/scanner"; -export type { InputParser, TypedCommandParameters } from "./parameter/types"; +export type { + Aliases, + InputParser, + TypedCommandFlagParameters, + TypedCommandParameters, + TypedCommandPositionalParameters, +} from "./parameter/types"; export { buildCommand } from "./routing/command/builder"; export type { CommandBuilderArguments } from "./routing/command/builder"; export type { Command } from "./routing/command/types"; diff --git a/packages/core/src/parameter/types.ts b/packages/core/src/parameter/types.ts index 82eab45..8840dbc 100644 --- a/packages/core/src/parameter/types.ts +++ b/packages/core/src/parameter/types.ts @@ -61,7 +61,7 @@ export type Aliases = Readonly>>; export type BaseFlags = Readonly>; -interface TypedCommandFlagParameters { +interface TypedCommandFlagParameters_ { /** * Typed definitions for all flag parameters. */ @@ -72,21 +72,21 @@ interface TypedCommandFlagParameters; } -type TypedCommandFlagParameters_ = +export type TypedCommandFlagParameters = Record extends FLAGS - ? Partial> - : TypedCommandFlagParameters; + ? Partial> + : TypedCommandFlagParameters_; -interface TypedCommandPositionalParameters { +interface TypedCommandPositionalParameters_ { /** * Typed definitions for all positional parameters. */ readonly positional: TypedPositionalParameters; } -type TypedCommandPositionalParameters_ = [] extends ARGS - ? Partial> - : TypedCommandPositionalParameters; +export type TypedCommandPositionalParameters = [] extends ARGS + ? Partial> + : TypedCommandPositionalParameters_; /** * Definitions for all parameters requested by the corresponding command. @@ -95,7 +95,7 @@ export type TypedCommandParameters< FLAGS extends BaseFlags, ARGS extends BaseArgs, CONTEXT extends CommandContext, -> = TypedCommandFlagParameters_ & TypedCommandPositionalParameters_; +> = TypedCommandFlagParameters & TypedCommandPositionalParameters; /** * Definitions for all parameters requested by the corresponding command.