From 77b31e891d0a246db709cf7dba81dd7cd19a5d44 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 4 Dec 2023 11:41:22 +1300 Subject: [PATCH] fix Subcommand type extraction (#407) --- .changeset/chatty-points-fetch.md | 5 +++++ src/CommandDescriptor.ts | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/chatty-points-fetch.md diff --git a/.changeset/chatty-points-fetch.md b/.changeset/chatty-points-fetch.md new file mode 100644 index 0000000..aa08a27 --- /dev/null +++ b/.changeset/chatty-points-fetch.md @@ -0,0 +1,5 @@ +--- +"@effect/cli": patch +--- + +fix Subcommand type extraction diff --git a/src/CommandDescriptor.ts b/src/CommandDescriptor.ts index a08533a..662d5ed 100644 --- a/src/CommandDescriptor.ts +++ b/src/CommandDescriptor.ts @@ -96,8 +96,11 @@ export declare namespace Command { */ export type Subcommands< A extends NonEmptyReadonlyArray]> - > = A[number] extends readonly [infer Id, Command] ? readonly [id: Id, value: Value] - : never + > = { + [I in keyof A]: A[I] extends readonly [infer Id, Command] + ? readonly [id: Id, value: Value] + : never + }[number] } /**