# get id()

## `CommonError.prototype.id`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor gets the error [identification](https://docs.angular-package.dev/error/getting-started/basic-concepts#identification) by returning the [`#id`](https://docs.angular-package.dev/error/commonerror/properties/id) property of a specified object.

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

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

{% endcode %}

### Return type

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

The **return type** is the generic type variable [`Id`](https://docs.angular-package.dev/error/generic-type-variables#commonerror-less-than-id-greater-than) or [`undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined).

### Returns

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

## Example usage

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

// Extend the `CommonError` class.
class TestError<Id extends string> extends CommonError<Id> {}

// Returns "(AE:427)".
new TestError('problem', 'Fix accessor.', '(AE:427)').id;
```


---

# 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://docs.angular-package.dev/error/commonerror/accessors/get-id.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.
