# static isError()

## `Error.isError()`

Checks whether the [`value`](#value-any) of [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any) type is an instance of [`Error`](https://docs.angular-package.dev/error/error) of any or the given [identification](#id-id).

{% code title="error.class.ts" %}

```typescript
public static isError<Id extends string>(
  value: any,
  id?: Id
): value is Error<Id> {
  return super.isError(value, id);
}
```

{% endcode %}

### Generic type variables

#### <mark style="color:green;">`Id`</mark>`extends`[<mark style="color:green;">`string`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#string)

A generic type variable constrained by the [`string`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), by default of the value **captured** from the provided optional [`id`](#id-id) indicates the [identification](https://docs.angular-package.dev/error/getting-started/basic-concepts#identification) type of the [`Error`](https://docs.angular-package.dev/error/error) via [return type](#return-type).

### Parameters

#### `value:`[<mark style="color:green;">`any`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#any)

The value of [`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) type to check against the [`Error`](https://docs.angular-package.dev/error/error) instance.

#### `id?:`[<mark style="color:green;">`Id`</mark>](#idextendsstring)

Optional unique [identification](https://docs.angular-package.dev/error/getting-started/basic-concepts#identification) of generic type variable [`Id`](#idextendsstring) that the given [`value`](#value-any) contains.

### Return type

#### `value is Error<`[<mark style="color:green;">`Id`</mark>](#idextendsstring)`>`

The **return type** is a [`boolean`](https://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) resulting from its statement indicating the [`value`](#value-any) is the [`Error`](https://docs.angular-package.dev/error/error) object that takes the generic type variable [`Id`](#idextendsstring).

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) type indicating whether the given [`value`](#value-any) is an instance of [`Error`](https://docs.angular-package.dev/error/error) of any or the given [`id`](#id-id).

## Example usage

```typescript
// Example usage.
import { Error } from '@angular-package/error';

// Define error.
const err = Error.define('Wrong type', 'Change the type', 'TE:201');

// Returns true.
Error.isError(err);

// Returns true.
Error.isError(err, 'TE:201');

// Returns false.
Error.isError(err, 'TE:202');

// Returns false.
Error.isError(new Array());
```
