Skip to content

Instantly share code, notes, and snippets.

@andreypopp
Created January 14, 2023 17:47
Show Gist options
  • Save andreypopp/e8eb9f44eb4af4ee646ca9a708e21df2 to your computer and use it in GitHub Desktop.
Save andreypopp/e8eb9f44eb4af4ee646ca9a708e21df2 to your computer and use it in GitHub Desktop.
type CmdArgsResult<C> = C extends Cmd<[], null, infer _O, infer _C>
? []
: C extends Cmd<infer A, null, infer _O, infer _C>
? [...{ [K in keyof A]: ArgResult<A[K]> }]
: C extends Cmd<[], infer RA, infer _O, infer _C>
? WithArgRestResult<[], RA>
: C extends Cmd<infer A, infer RA, infer _O, infer _C>
? WithArgRestResult<[...{ [K in keyof A]: ArgResult<A[K]> }], RA>
: never;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment