GuardsisErrorisError CallableisError(x: unknown): x is ErrorChecks if x is classified as Error. ExampleisError(new Error("this is an error"))// => trueisError("foobar")// => false Alternatives[Lodash - isError]https://lodash.com/docs/#isError)Parametersx: unknownThe value to check.Returns x is Errortrue if x is an Error, false otherwise.
Checks if
x
is classified as Error.Example
Alternatives