Skip to content

Function: args() ​

WARNING

This API is experimental and may change in future versions.

Type-safe schema factory.

Returns the input unchanged at runtime, but provides type inference so that satisfies Args is not needed.

Signature ​

ts
declare function args<T extends Args>(fields: T): T

Type Parameters ​

NameDescription
T extends ArgsThe exact schema type.

Parameters ​

NameTypeDescription
fieldsTThe argument schema object.

Returns ​

T — The same schema object with its type inferred.

Examples ​

ts
const common = args({
  verbose: boolean(),
  help: short(boolean(), 'h')
})

Released under the MIT License.