Skip to content

Function: describe()

WARNING

This API is experimental and may change in future versions.

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

The original schema is not modified.

Signature

ts
declare function describe<T, D extends string>(schema: CombinatorSchema<T>, text: D): CombinatorSchema<T> & CombinatorDescribe<D>

Type Parameters

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

Parameters

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

Returns

CombinatorSchema<T> & CombinatorDescribe<D> — A new schema with the description set.

Examples

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

Released under the MIT License.