# 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://docs.angular-package.dev/error/constructor#id-id) indicates the [identification](https://docs.angular-package.dev/error/getting-started/basic-concepts#identification) type of a new [`RangeError`](https://docs.angular-package.dev/error/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://docs.angular-package.dev/error/constructor#min-min) indicates the minimum range type of a new [`RangeError`](https://docs.angular-package.dev/error/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://docs.angular-package.dev/error/constructor#max-max) indicates the maximum range type of a new [`RangeError`](https://docs.angular-package.dev/error/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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.angular-package.dev/error/rangeerror/generic-type-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
