Skip to content

gunshi / combinators / describe

Function: describe()

ts
function describe<T, D>(schema, text): ArgSchema & Combinator<T> & CombinatorDescribe<D>;

Experimental

Set a description on a combinator schema for help text generation.

The original schema is not modified.

Type Parameters

Type ParameterDescription
TThe schema's parsed type.
D extends stringThe description string literal type.

Parameters

ParameterTypeDescription
schemaCombinatorSchema<T>The base combinator schema.
textDHuman-readable description.

Returns

ArgSchema & Combinator<T> & CombinatorDescribe<D>

A new schema with the description set.

Example

ts
const args = {
  port: describe(integer(), 'Port number to listen on')
}

Released under the MIT License.