Skip to content

gunshi / combinators / args

Function: args()

ts
function args<T>(fields): T;

Experimental

Type-safe schema factory.

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

Type Parameters

Type ParameterDescription
T extends ArgsThe exact schema type.

Parameters

ParameterTypeDescription
fieldsTThe argument schema object.

Returns

T

The same schema object with its type inferred.

Example

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

Released under the MIT License.