Generic type variables

The `Error` object generic type variables

Error<Id>

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 Error instance.

error.class.ts
class Error<
  Id extends string  // <--- Declare generic type variable Id.
> extends CommonError<Id> {
  ...
  constructor(
    problem: string,
    fix: string,
    id?: Id,  // <--- Capture generic type variable Id.
    template = Error.template
  ) { ... }
  ...
}

Last updated