Skip to content

FlagSchema

The runtime descriptor stored inside every FlagBuilder. Consumers (parser, help generator, resolution chain) read this to understand the flag's shape without touching generics.

Signatures

ts
interface FlagSchema {}

Members

Properties

aliases

Short/long aliases (e.g. [{ name: 'f', hidden: false }] for --force).

ts
aliases: readonly FlagAlias[];

configPath

Dotted config path for v0.2+ resolution (e.g. 'deploy.region').

ts
configPath: string | undefined;

defaultValue

Runtime default value (if any).

ts
defaultValue: unknown;

deprecated

Deprecation marker.

  • undefined — not deprecated (default)
  • true — deprecated with no migration message
  • string — deprecated with a reason/migration message

When a deprecated flag is used, a warning is emitted to stderr. Help text shows [deprecated] or [deprecated: <reason>].

ts
deprecated: string | true | undefined;

description

Human-readable description for help text.

ts
description: string | undefined;

elementSchema

Element schema when kind === 'array'.

ts
elementSchema: FlagSchema | undefined;

enumValues

Allowed literal values when kind === 'enum'.

ts
enumValues: readonly string[] | undefined;

envVar

Environment variable name for v0.2+ resolution.

ts
envVar: string | undefined;

kind

What kind of value this flag accepts.

ts
kind: "string" | "number" | "boolean" | "enum" | "array" | "custom";

parseFn

Custom parse function (only when kind === 'custom').

ts
parseFn: FlagParseFn<unknown> | undefined;

presence

Current presence state.

ts
presence: "optional" | "required" | "defaulted";

prompt

Interactive prompt configuration for v0.3+ resolution.

ts
prompt: PromptConfig | undefined;

propagate

Whether this flag propagates to subcommands in nested command trees.

When true, the flag is automatically available to all descendant commands. A child command that defines a flag with the same name shadows the propagated parent flag.

ts
propagate: boolean;

See Also

Released under the MIT License.