Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
fix Subcommand type extraction (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Dec 3, 2023
1 parent f15e5c3 commit 77b31e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-points-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/cli": patch
---

fix Subcommand type extraction
7 changes: 5 additions & 2 deletions src/CommandDescriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ export declare namespace Command {
*/
export type Subcommands<
A extends NonEmptyReadonlyArray<readonly [id: unknown, command: Command<any>]>
> = A[number] extends readonly [infer Id, Command<infer Value>] ? readonly [id: Id, value: Value]
: never
> = {
[I in keyof A]: A[I] extends readonly [infer Id, Command<infer Value>]
? readonly [id: Id, value: Value]
: never
}[number]
}

/**
Expand Down

0 comments on commit 77b31e8

Please sign in to comment.