# static isValidationError()

## `ValidationError.isValidationError()`

Checks whether the [`value`](#value-any) of any type is the [`ValidationError`](https://docs.angular-package.dev/error/validationerror) instance of any or the given [identification](#id-id).

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

```typescript
public static isValidationError<Id extends string>(
  value: any,
  id?: Id
): value is ValidationError<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 [`ValidationError`](https://docs.angular-package.dev/error/validationerror) 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 [`ValidationError`](https://docs.angular-package.dev/error/validationerror) 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) to check whether the given [`value`](#value-any) contains.

### Return type

#### `value is ValidationError<`[<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 [`ValidationError`](https://docs.angular-package.dev/error/validationerror) 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 [`ValidationError`](https://docs.angular-package.dev/error/validationerror) of any or the supplied optional [`id`](#id-id) properties.

## Example usage

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

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

// Returns true.
ValidationError.isValidationError(err);

// Returns true.
ValidationError.isValidationError(err, 'TE:201');

// Returns true.
ValidationError.isValidationError(err, 'TE:201');

// Returns false.
ValidationError.isValidationError(err, 'TE:202');

// Returns false.
ValidationError.isValidationError(new Array());
```
