Generic type variables

The `RangeError` object generic type variables

RangeError<Id,Min,Max>

Idextendsstring

​A generic type variable constrained by the string, by default of the value captured from the provided id indicates the identification type of a new RangeError instance.

range-error.class.ts
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
  ) { ... }
  ...
}

RangeError<Id,Min,Max>

​A generic type variable constrained by the number and undefined, by default of the value captured from the provided min indicates the minimum range type of a new RangeError instance.

range-error.class.ts
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
  ) { ... }
  ...
}

RangeError<Id,Min,Max>

​A generic type variable constrained by the number and undefined by default of the value captured from the provided max indicates the maximum range type of a new RangeError instance.

range-error.class.ts
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
  ) { ... }
  ...
}

Last updated