Overview

The `TypeError` object

TypeError {}

The TypeError object is an extension of the CommonError class and is thrown when an operation could not be performed, typically(but not exclusively) when a value is not of the expected type, with the message built from the described problem and its solution, optional an explicit identification and type, on the given or stored template.

Accessors

public get name(): string The get accessor obtains error name of a string type, set to 'TypeError' that is being thrown.

public get type(): Type | undefined The get accessor obtains the type of generic type variable Type that causes an error to be thrown(or not thrown) if set, otherwise returns undefined.

public get [Symbol.toStringTag](): string The get accessor, with the help of toStringTag, changes the default tag to 'TypeError' for an instance of TypeError.

Properties

public static template: string A template of the error message of string type with the replaceable {problem}, {fix} and optional {id}, {max}, {min}, {type} tags.

#type?: string Private string-type property of the type that causes an error to be thrown(or not thrown).

Methods

public static define(): TypeError<Id, Type> Defines the TypeError instance with the message built of the given required problem, fix and optional id and type on the given or stored template.

public static isTypeError(): value is TypeError<Id, Type> Checks whether the value of any type is an instance of TypeError of any or the given type and identification.

Last updated