Skip to content

@graphty/graphty-element / index / isGraphtyErrorCode

Function: isGraphtyErrorCode() ​

isGraphtyErrorCode(value): value is GraphtyErrorCode

Defined in: graphty-element/src/errors/codes.ts:493

Narrows an unknown value to a GraphtyErrorCode.

Use it on a code string that arrived from outside the element -- a sibling package's error, a saved document, a message from a worker -- before switching on it.

Parameters ​

value ​

unknown

The value to test.

Returns ​

value is GraphtyErrorCode

True when the value is one of the element's error codes.