Runtime type-validation with derived TypeScript types.
Class | Description |
---|---|
ArrayType | The implementation behind types created with array(). |
InterfaceType | The implementation behind types created with object() and partial(). |
IntersectionType | The implementation behind types created with intersection() and BaseObjectLikeTypeImpl.and(). |
KeyofType | The implementation behind types created with keyof() and valueof(). |
LiteralType | The implementation behind types created with literal() and nullType, undefinedType and voidType. |
RecordType | The implementation behind types created with record(). |
SimpleType | Implementation for simple types such as primitive types. |
UnionType | The implementation behind types created with union() and BaseTypeImpl.or(). |
ValidationError | The error that is thrown on any validation- or parse-error within this library. |
Abstract Class | Description |
---|---|
BaseObjectLikeTypeImpl | The base implementation for all object-like Types. |
BaseTypeImpl | The base-class of all type-implementations. |
Function | Description |
---|---|
array(args) | Create a type that checks whether the input is an array and all elements conform to the given elementType . |
booleanAutoCaster(input) | |
createType(impl, override) | Create a Type from the given type-implementation. |
intersection(args) | Intersect the given types. |
isType(value) | Type-guard that asserts that a given value is a Type. |
keyof(args) | |
literal(value) | |
numberAutoCaster(input) | |
object(args) | Create a type-validator that validates (or parses) an object structure. |
partial(args) | Create a type-validator that validates (or parses) an object structure with only optional properties. |
pattern(name, regExp, customMessage) | |
printKey(key) | Print a property-key in a JavaScript compatible way. |
printPath(path) | Print a property-path in a "JavaScripty way". |
printValue(input, budget, visited) | Print an unknown value with a given character budget (default: 50). |
record(args) | Note: record has strict validation by default, while type does not have strict validation, both are strict in construction though. TODO: document |
reportError_2(root, level, omitInput) | Creates an human-readable error report of the given failure. |
union(args) | |
valueof(args) |
Interface | Description |
---|---|
ArrayTypeConfig | Configuration of additional checks on array types. |
Failure | A failed validation result. |
InterfaceMergeOptions | Options for InterfaceType.withOptional(), InterfaceType.withRequired() and InterfaceType.mergeWith(). |
InterfacePickOptions | Options for InterfaceType.pick() and InterfaceType.omit(). |
InterfaceTypeOptions | Options for object(). |
InterfaceTypeOptionsWithPartial | |
LengthChecksConfig | |
ParserOptions | Options that can be passed to BaseTypeImpl.withParser(). |
SimpleTypeOptions | |
StringTypeConfig | Configuration of additional checks on string types. |
Success | A successful validation result. |
TypedPropertyInformation | Interface that provides more detailed type-information about the props and propsInfo properties of the validator. |
TypeLink | An object that has an associated TypeScript type. |
ValidationOptions | |
Visitor | Interface for a visitor that is accepted by all types (classic visitor-pattern). |
Variable | Description |
---|---|
autoCastFailure | Returned by an autocaster to indicate that it is not able to auto-cast the given input. |
boolean | Built-in validator for boolean-values. |
brands | The symbol that gives access to the (design-time-only) brands of a Type. |
designType | The symbol that gives access to the (design-time-only) associated TypeScript type of a Type. |
int | |
nullType | |
number | |
string | Built-in validator for string-values. |
undefinedType | |
unknown | Built-in validator that accepts all values. |
unknownArray | Built-in validator that accepts all arrays. |
unknownRecord | Built-in validator that accepts all objects (null is not accepted). |
voidType |
Type Alias | Description |
---|---|
ArrayViolation | The supported additional checks on array types. |
BasicType | Basic categories of types. |
Branded | Create a Branded type with a given BrandName . |
CustomMessage | The type for optional custom messages |
DeepUnbranded | Unbrand a given type (recursive). |
FailureDetails | Individual message with info about the performed validation for error-reporting. |
FullType | Result of the object() function. |
int | |
IntersectionOfTypeTuple | |
LengthViolation | |
LiteralValue | The supported types of literals. |
MergeIntersection | Merge an intersection of types into one type, mostly for tooltip-readability in IDEs. |
MergeType | Result of the InterfaceType.withOptional(), InterfaceType.withRequired() and InterfaceType.mergeWith() methods. |
MessageDetails | Individual message details with optional info about the performed validation. |
NumberTypeConfig | Configuration of additional checks on numeric types. |
NumberViolation | The supported additional checks on numeric types. |
ObjectType | A type-validator/-parser that validates or parses object-like type ResultType . |
OneOrMore | An Array with at least one element. |
PartialType | Result of the partial() function and the InterfaceType.toPartial() method. |
PickType | Result of the InterfaceType.pick() and InterfaceType.omit() methods. |
PossibleDiscriminator | A description of the property-paths and possible values that might be used to identify this type inside a union. |
Primitive | |
Properties | The properties of an object type. |
PropertiesInfo | Properties of an object type, including per-property optionality. |
PropertiesOfTypeTuple | |
PropertyInfo | Information about a single property of an object-like type including its optionality. |
Result | The result of a type validation. |
Simplify | Flatten the type output to improve type hints as shown in editors. |
StringViolation | The supported additional checks on string types. |
The | Obtains the TypeScript type of the given runtime Type-checker. Aka TypeOf. |
Transposed | |
Type | A type-validator/-parser that validates or parses ResultType . |
TypeguardFor | The type of the type-guard that comes with each Type (the #is method). |
TypeguardResult | The resulting type of a typeguard based on the ResultType of the Type and the given Input . |
TypeImpl | The Type with the given type implementation. |
TypeOf | Obtains the TypeScript type of the given runtime Type-checker. Aka The. |
TypeOfProperties | Translates the type of a Properties-object into the proper TypeScript type to be used in user-code. |
Unbranded | Unbrand a given type (not recursive). |
unknownArray | Built-in validator that accepts all arrays. |
unknownRecord | Built-in validator that accepts all objects (null is not accepted). |
ValidationDetails | Information about the performed validation for error-reporting. |
ValidationMode | The validation mode to use. |
ValidationResult | The possible return values inside validation and constraint functions. |
Validator | The validation-logic as needed by BaseTypeImpl.withConstraint() and BaseTypeImpl.withValidation(). |
WithBrands | |
Writable | The opposite of the built-in Readonly<...> type. |