Skip to content

Function: isScpError() ​

ts
function isScpError(value, code?): value is ScpError;

Whether value is a ScpError, optionally with a specific code. Narrows the type in TypeScript.

Parameters ​

ParameterType
valueunknown
code?ErrorCode

Returns ​

value is ScpError

Example ​

ts
if (isScpError(err, ErrorCode.NotFound)) console.log(`missing: ${err.path}`);

Released under the MIT License.