Skip to main content

Class: TypeCheckError

A type checking error.

Constructors​

Constructor​

new TypeCheckError(data): TypeCheckError;

Creates a type check error from an object payload.

Parameters​

ParameterTypeDescription
dataTypeCheckErrorDataType check error data.

Returns​

TypeCheckError

Constructor​

new TypeCheckError(
path,
expectedTypeName,
actualValue,
typeCheckedValue?
): TypeCheckError;

Parameters​

ParameterTypeDescription
pathPathSub-path (where the root is the value being type checked) where the error occurred.
expectedTypeNamestringName of the expected type.
actualValueanyActual value.
typeCheckedValue?anyThe value where the type check was invoked.

Returns​

TypeCheckError

Deprecated​

Use the object payload constructor instead for better readability and maintainability.

Creates a type check error from positional parameters.

Properties​

actualValue​

readonly actualValue: any;

expectedTypeName​

readonly expectedTypeName: string;

message​

readonly message: string;

modelTrail?​

readonly optional modelTrail?: readonly string[];

path​

readonly path: Path;

typeCheckedValue?​

readonly optional typeCheckedValue?: any;

Methods​

throw()​

throw(): never;

Throws the type check error as an actual error.

Returns​

never