# Generic type variables

## `RangeError<`<mark style="color:green;background-color:green;">`Id`</mark>`,Min,Max>`

#### <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 [`id`](https://error.angular-package.dev/constructor#id-id) indicates the [identification](https://error.angular-package.dev/getting-started/basic-concepts#identification) type of a new [`RangeError`](https://error.angular-package.dev/rangeerror) instance.

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

```typescript
class RangeError<
  Id extends string, // <--- Declare generic type variable Id.
  Min extends number | undefined = undefined,
  Max extends number | undefined = undefined
> extends CommonError<Id> {
  ...
  constructor(
    problem: string,
    fix: string,
    id?: Id, // <--- Capture generic type variable Id.
    min?: Min,
    max?: Max,
    template = RangeError.template
  ) { ... }
  ...
}
```

{% endcode %}

## `RangeError<Id,`<mark style="color:green;background-color:green;">`Min`</mark>`,Max>`

#### <mark style="color:green;">`Min`</mark>`extends`[<mark style="color:green;">`number`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#number)`|`[<mark style="color:green;">`undefined`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined)`=`[<mark style="color:green;">`undefined`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined)

​A generic type variable constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) and [`undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined), by default of the value **captured** from the provided [`min`](https://error.angular-package.dev/constructor#min-min) indicates the minimum range type of a new [`RangeError`](https://error.angular-package.dev/rangeerror) instance.

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

```typescript
class RangeError<
  Id extends string,
  Min extends number | undefined = undefined, // <--- Declare generic type variable Min.
  Max extends number | undefined = undefined
> extends CommonError<Id> {
  ...
  constructor(
    problem: string,
    fix: string,
    id?: Id,
    min?: Min, // <--- Capture generic type variable Min.
    max?: Max,
    template = RangeError.template
  ) { ... }
  ...
}
```

{% endcode %}

## `RangeError<Id,Min,`<mark style="color:green;background-color:green;">`Max`</mark>`>`

#### <mark style="color:green;">`Max`</mark>`extends`[<mark style="color:green;">`number`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#number)`|`[<mark style="color:green;">`undefined`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined)`=`[<mark style="color:green;">`undefined`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined)

​A generic type variable constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) and [`undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined) by default of the value **captured** from the provided [`max`](https://error.angular-package.dev/constructor#max-max) indicates the maximum range type of a new [`RangeError`](https://error.angular-package.dev/rangeerror) instance.

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

```typescript
class RangeError<
  Id extends string,
  Min extends number | undefined = undefined,
  Max extends number | undefined = undefined // <--- Declare generic type variable Max.
> extends CommonError<Id> {
  ...
  constructor(
    problem: string,
    fix: string,
    id?: Id,
    min?: Min,
    max?: Max, // <--- Capture generic type variable Max.
    template = RangeError.template
  ) { ... }
  ...
}
```

{% endcode %}
