# get type()

## ​`TypeError.prototype.type`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor obtains the type of generic type variable [`Type`](https://error.angular-package.dev/generic-type-variables#typeerror-less-than-id-type-greater-than-1) that causes an error to be thrown(or not thrown) if set, otherwise returns [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined).

{% code title="type-error.class.ts" %}

```typescript
public get type(): Type | undefined {
  return this.#type;
}
```

{% endcode %}

### Return type

#### [<mark style="color:green;">`Type`</mark>](https://error.angular-package.dev/generic-type-variables#typeerror-less-than-id-type-greater-than-1)`|`[<mark style="color:green;">`undefined`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined)

### Returns

The **return value** is the type of generic type variable [`Type`](https://error.angular-package.dev/generic-type-variables#typeerror-less-than-id-type-greater-than-1) or [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined).

## Example usage

```typescript
// Example usage.
import { TypeError } from '@angular-package/error';

// Returns "string".
new TypeError('problem', 'Fix accessor.', '(TE:201)', 'string').type;
```


---

# 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://error.angular-package.dev/typeerror/accessors/get-type.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.
