strictcli v0.39.0 /typescript/src/infer
On this page

Handler-args inference: computes the precise args object type a handler receives from a command's keyed flag map and ordered arg tuple.

#typescript/src/infer

#typescript/src/infer

Handler-args inference: computes the precise args object type a handler receives from a command's keyed flag map and ordered arg tuple.

Optionality mirrors the runtime kwargs contract of the siblings:

  • flags: scalar with default: null (explicitly optional) -> true ?: key;

everything else (required, defaulted, list, dict) -> always-present key.

  • args: required: false with no default -> true ?: key (the siblings

omit the kwarg entirely); variadic -> always-present array.

#InferHandlerArgs

TS typescript
export type InferHandlerArgs<

Computes the handler args type from a flag map and arg tuple. Flags with default: null become optional keys; args with required: false and no default become optional keys.

#HandlerArgs

TS typescript
export type HandlerArgs<

The complete args object a handler receives: direct flags, positional args, plus every flag contributed by flag sets and mutex groups. The empty case short-circuits to InferHandlerArgs so the type stays identical (not merely mutually assignable) to the plain flags/args inference.

#InferHandler

TS typescript
export type InferHandler<C extends AnyCommand> = Parameters<C["handler"]>[0]

Handler-args type of a command carrier produced by defineCommand. Derived from the stored handler's parameter type so flag-set and mutex flags are included.

Search