Constructs a new InvalidTypeError
with the specified key, expected
type, and actual type.
The name of the key with the invalid type.
The expected type of the value.
The actual type of the value.
Optional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
Static
stack
The
InvalidTypeError
is thrown when a value associated with a key is not of the expected type.This error helps enforce type safety in parsers by signaling when the actual type of a value differs from the expected type.
Example