# Overview

## `TypeError {}`

The `TypeError` object is an extension of the [`CommonError`](https://error.angular-package.dev/draft-5/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](https://error.angular-package.dev/draft-5/commonerror/accessors/get-message) built from the described problem and its solution, optional an explicit identification and type, on the given or stored template.

{% embed url="<https://github.com/angular-package/error/blob/main/src/lib/type-error.class.ts>" %}
`type-error.class.ts`
{% endembed %}

### Accessors

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>public get</strong> <a href="accessors/get-name"><strong>name()</strong></a><strong>:</strong> <mark style="color:green;">string</mark><br>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get"><code>get</code></a> accessor obtains error name of a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String"><code>string</code></a> type, set to <code>'TypeError'</code> that is being thrown.</p>                                                                                                                                                                                                                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| <p><strong>public get</strong> <a href="accessors/get-type"><strong>type()</strong></a><strong>:</strong> <mark style="color:green;">Type</mark>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | <mark style="color:green;">undefined</mark><br>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get"><code>get</code></a> accessor obtains the type of generic type variable <a href="../generic-type-variables#typeerror-less-than-id-type-greater-than-1"><code>Type</code></a> that causes an error to be thrown(or not thrown) if set, otherwise returns <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined"><code>undefined</code></a>.</p> |
| <p><strong>public get</strong> <a href="accessors/get-symbol.tostringtag"><strong>[Symbol.</strong><mark style="color:blue;"><strong>toStringTag</strong></mark><strong>](https://error.angular-package.dev/draft-5/typeerror)</strong></a><strong>:</strong> <mark style="color:green;">string</mark><br>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get"><code>get</code></a> accessor, with the help of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag"><code>toStringTag</code></a>, changes the default tag to <code>'TypeError'</code> for an instance of <a href=""><code>TypeError</code></a>.</p> |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

### Properties

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>public static</strong> <a href="properties/static-template"><strong>template</strong></a><strong>:</strong> <mark style="color:green;">string</mark><br>A template of the error message of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String"><code>string</code></a> type with the replaceable <a href="../../commonerror/properties/static-template#problem"><code>{problem}</code></a>, <a href="../../commonerror/properties/static-template#fix"><code>{fix}</code></a> and optional <a href="../../commonerror/properties/static-template#id"><code>{id}</code></a>, <a href="../../commonerror/properties/static-template#max"><code>{max}</code></a>, <a href="../../commonerror/properties/static-template#min"><code>{min}</code></a>, <a href="../../commonerror/properties/static-template#type"><code>{type}</code></a> tags.</p> |
| <p><a href="properties/type"><strong>#type?</strong></a><strong>:</strong> <mark style="color:green;">string</mark><br>Private <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string-type</a> property of the type that causes an error to be thrown(or not thrown).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

### Methods

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p><strong>public static</strong> <a href="methods/static-define"><strong>define()</strong></a><strong>:</strong> <mark style="color:green;">TypeError</mark><<mark style="color:green;">Id</mark>, <mark style="color:green;">Type</mark>><br>Defines the <a href=""><code>TypeError</code></a> instance with the <a href="../commonerror/accessors/get-message">message</a> built of the given required <a href="../methods/static-define#problem-string"><code>problem</code></a>, <a href="../methods/static-define#fix-string"><code>fix</code></a> and optional <a href="../methods/static-define#id-id"><code>id</code></a> and <a href="../methods/static-define#type-type"><code>type</code></a> on the given or stored <a href="../methods/static-define#template-typeerror.template"><code>template</code></a>.</p> |
| <p><strong>public static</strong> <a href="methods/static-istypeerror"><strong>isTypeError()</strong></a><strong>:</strong> value is <mark style="color:green;">TypeError</mark><<mark style="color:green;">Id</mark>, <mark style="color:green;">Type</mark>><br>Checks whether the <a href="../methods/static-istypeerror#value-any"><code>value</code></a> of <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html#any"><code>any</code></a> type is an instance of <a href=""><code>TypeError</code></a> of any or the given <a href="../methods/static-istypeerror#type-type"><code>type</code></a> and <a href="../methods/static-istypeerror#id-id">identification</a>.</p>                                                                                                                           |
