A value to be asserted
Optional
errorFactory: ((props: TypeGuardError.IProps) => Error)Custom error factory. Default is TypeGuardError
Parametric input value
A TypeGuardError instance with detailed reason
Jeongho Nam - https://github.com/samchon
Asserts equality between a value and its type.
Asserts a parametric value type and throws a TypeGuardError with detailed
reason, if the parametric value is not following the type T
or some superfluous
property that is not listed on the type T
has been found. Otherwise, the value is
following the type T
without any superfluous property, just input parameter would
be returned.
If what you want is not asserting but just knowing whether the parametric value is
following the type T
or not, you can choose the equals function instead.
Otherwise, you want to know all the errors, validateEquals is the way to go.
On the other hand, if you want to allow superfluous property that is not enrolled
to the type T
, you can use assert function instead.
A value to be asserted
Optional
errorFactory: ((props: TypeGuardError.IProps) => Error)Custom error factory. Default is TypeGuardError
Parametric input value casted as T
A TypeGuardError instance with detailed reason
Jeongho Nam - https://github.com/samchon
Asserts equality between a value and its type.
Asserts a parametric value type and throws a TypeGuardError with detailed reason, if the parametric value is not following the type
T
or some superfluous property that is not listed on the typeT
has been found. Otherwise, the value is following the typeT
without any superfluous property, just input parameter would be returned.If what you want is not asserting but just knowing whether the parametric value is following the type
T
or not, you can choose the equals function instead. Otherwise, you want to know all the errors, validateEquals is the way to go.On the other hand, if you want to allow superfluous property that is not enrolled to the type
T
, you can use assert function instead.