Skip to content

createArgSchema

Generated reference page for the createArgSchema function export.

Signatures

ts
function createArgSchema(kind: "string" | "number" | "enum" | "custom", overrides?: Partial<ArgSchema>): ArgSchema;
ParameterTypeDescription
kind"string" | "number" | "enum" | "custom"Discriminator for the value type this arg accepts.
overridesPartial<ArgSchema> | undefinedPartial schema fields shallow-merged onto defaults.

Members

Members

createArgSchema

Create a raw ArgSchema object with sensible defaults.

Most consumers should prefer the higher-level arg factory, which returns an immutable ArgBuilder with type inference and fluent modifiers. createArgSchema() exists for advanced schema composition, targeted tests, or custom builders that need the plain runtime descriptor.

overrides are shallow-merged on top of the default shape, so callers are responsible for preserving invariants such as variadic ordering and compatible parseFn / kind combinations.

ts
(kind: "string" | "number" | "enum" | "custom", overrides?: Partial<ArgSchema>): ArgSchema;

Examples

ts
const schema = createArgSchema('custom', {
  description: 'Hex color',
  parseFn: (raw) => `#${raw}`,
});

See Also

Released under the MIT License.