Const
The error schema validates that the input is a JavaScript Error object. It is an alias for instance(Error).
error
instance(Error)
import { error } from "typerun/schema";import { is } from "typerun";const isError = is(error)(new Error());console.log(isError); // trueconst isNotError = is(error)(3);console.log(isNotError); // false Copy
import { error } from "typerun/schema";import { is } from "typerun";const isError = is(error)(new Error());console.log(isError); // trueconst isNotError = is(error)(3);console.log(isNotError); // false
The
error
schema validates that the input is a JavaScript Error object. It is an alias forinstance(Error)
.Example