static isError()

Checks whether the value of any type is a this instance of any or the given identification

CommonError.isError()

Checks whether the value of any type is a this instance of any or the given identification.

common-error.class.ts
protected static isError<Id extends string>(
  value: any,
  id?: Id
): value is CommonError<Id> {
  return typeof value === 'object' && value instanceof this
    ? typeof id === 'string'
      ? value.id === id
      : true
    : false;
}

Generic type variables

Idextendsstring

A generic type variable constrained by the string indicates the

Parameters

value:any

The value of any type to check against the this instance.

id?:Id

Optional identification of generic type variable Id to check whether the given value contains.

Return type

value isCommonError<Id>

The return type is a boolean indicating the value is the CommonError object that takes generic type variable Id.

Returns

The return value is a boolean type indicating whether the given value is a this instance of any or the given id.

Example usage

Last updated

Was this helpful?