Skip to content

ArgSchema ​

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

Signatures ​

ts
interface ArgSchema<K extends ArgKind> {}

Members ​

Properties ​

[schemaBrand] ​

Type-only seal produced by createArgSchema.

ts
[schemaBrand]: "arg";

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 arg 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;

enumValues ​

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

ts
enumValues: readonly string[] | undefined;

envVar ​

Environment variable name for env resolution.

When set and the CLI value is absent, the resolver reads this env var and coerces the string to the arg's declared kind.

ts
envVar: string | undefined;

kind ​

What kind of value this arg accepts.

ts
kind: ArgSchema.K;

numberConstraints ​

Numeric constraints when kind === 'number' (undefined otherwise).

Enforced at the parse and resolution boundaries. finite defaults to true, so Infinity is rejected even when no constraints object is set.

ts
numberConstraints: NumberConstraints | undefined;

parseFn ​

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

ts
parseFn: ArgParseFn<unknown> | undefined;

presence ​

Current presence state.

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

standard ​

Standard Schema v1 validator applied to the resolved value.

When set, the value from any source (CLI, env, stdin, default) is validated after resolution via ~standard.validate. Sync and async validators are both awaited; issues surface as a CONSTRAINT_VIOLATED ValidationError. Only meaningful when kind === 'custom'.

ts
standard: StandardSchemaV1<unknown, unknown> | undefined;

stdinMode ​

Whether this arg may read from stdin during resolution.

ts
stdinMode: boolean;

variadic ​

Whether this arg consumes all remaining positionals.

ts
variadic: boolean;

See Also ​

Released under the MIT License.