Skip to main content
values.VSemantic A domain contract uses the ordinary value representation on the wire.

Type parameters

Hierarchy

  • BaseValidator<Type, IsOptional, FieldPaths> ↳ VSemantic

Constructors

constructor

• new VSemantic<Type, IsOptional, FieldPaths>(definition, isOptional, baseValidator?)

Type parameters

Parameters

Overrides

BaseValidator&lt;Type, IsOptional, FieldPaths&gt;.constructor

Properties

type

• Readonly type: Type Only for TypeScript, the TS type of the JS values validated by this validator.

Inherited from

BaseValidator.type

fieldPaths

• Readonly fieldPaths: FieldPaths Only for TypeScript, if this an Object validator, then this is the TS type of its property names.

Inherited from

BaseValidator.fieldPaths

isOptional

• Readonly isOptional: IsOptional Whether this is an optional Object property value validator.

Inherited from

BaseValidator.isOptional

isConvexValidator

• Readonly isConvexValidator: true Always "true".

Inherited from

BaseValidator.isConvexValidator

kind

• Readonly kind: "semantic"

baseValidator

• Optional Readonly baseValidator: Validator<any, "required", any>

Accessors

json

• get json(): ValidatorJSON

Returns

ValidatorJSON

Overrides

BaseValidator.json

Methods

parse

▸ parse(value): Type

Parameters

Returns

Type

safeParse

▸ safeParse(value): { success: true ; data: Type } | { success: false ; error: SemanticValueError }

Parameters

Returns

{ success: true ; data: Type } | { success: false ; error: SemanticValueError }

optional

▸ optional(): VSemantic<Type | undefined, "optional", FieldPaths>

Returns

VSemantic<Type | undefined, "optional", FieldPaths>

Overrides

BaseValidator.optional

asOptional

▸ asOptional(): VSemantic<undefined | Type, "optional", FieldPaths>

Returns

VSemantic<undefined | Type, "optional", FieldPaths>

Overrides

BaseValidator.asOptional

required

▸ required(): VSemantic<Exclude<Type, undefined>, "required", FieldPaths> Retain the domain contract and native file metadata when requiring a value.

Returns

VSemantic<Exclude<Type, undefined>, "required", FieldPaths>