Class: TypeCheckError
A type checking error.
Constructors
Constructor
new TypeCheckError(data): TypeCheckError;
Creates a type check error from an object payload.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | TypeCheckErrorData | Type check error data. |
Returns
TypeCheckError
Constructor
new TypeCheckError(
path,
expectedTypeName,
actualValue,
typeCheckedValue?
): TypeCheckError;
Parameters
| Parameter | Type | Description |
|---|---|---|
path | Path | Sub-path (where the root is the value being type checked) where the error occurred. |
expectedTypeName | string | Name of the expected type. |
actualValue | any | Actual value. |
typeCheckedValue? | any | The 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