Function: required()
WARNING
This API is experimental and may change in future versions.
Mark a combinator schema as required.
The original schema is not modified. Other modifiers on schema (for example multiple) are kept.
Signature
ts
declare function required<S extends CombinatorSchema<unknown>>(schema: S): WithFlag<S, CombinatorRequired>Type Parameters
| Name | Description |
|---|---|
S extends CombinatorSchema<unknown> | The input combinator schema. |
Parameters
| Name | Type | Description |
|---|---|---|
schema | S | The base combinator schema. |
Returns
WithFlag<S, CombinatorRequired> — A copy of schema with required: true.
Examples
ts
const args = {
name: required(string())
}