# Explanation

### Partial primitive value with the exact return type

This example explains what **partial primitive value** and the **exact return type** means in the [`Wrap`](/wrapper/wrap/overview.md) `string` object.

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

// Define tag [quote].
const quoteTag = new Wrap(
  // quoteTag.opening;
  `[`,
  // quoteTag.closing;
  `]`,
  // quoteTag.content;
  'quote'
);

// The opening is of a generic type variable Opening in this case it's [.
quoteTag.opening;

// The closing is of a generic type variable Closing in this case it's ].
quoteTag.closing;

// The content is of a generic type variable Content in this case it's quote.
quoteTag.content;

```

To create primitive value of [`Wrap`](/wrapper/wrap/overview.md) object there is the need to provide three parameters in order `opening`, `closing`, and optional `content`. They are stored in separate private properties which are accessible with the help of accessors, and because of this, access to **parts of the primitive value** is achieved. More, each parameter is of a generic type variable that detects the type of given value, and because of this, the **exact return type** of **primitive value** and its **parts** is achieved.

#### Immutability

All the parts that make up the primitive value of the [`Wrap`](/wrapper/wrap/overview.md) object are **immutable** because they are accessible only by the `get` accessors. There is no possibility to change any part of the primitive value of the `quoteTag` object and any try to change e.g. `opening` results in the error message "*Cannot assign to 'opening' because it is a read-only property*".&#x20;

```typescript

// Cannot assign to 'opening' because it is a read-only property
// and the opening is of a generic type variable Opening in this case it's `[`.
quoteTag.opening = ; 

```

### Object as types

There is possibility to check whether the object is the `wrapper` with the help of `typeOf()` function. The name of `bbCodeWrapper` object cannot be changed in the example below.

```typescript
// Example usage.
import { Wrapper } from '@angular-package/text';
import { typeOf } from '@angular-package/type';

class CustomWrap {
  bbCode: Wrapper<`[`, `]`> = new Wrapper(`[`, `]`);
  html: Wrapper<'<', '>'> = new Wrapper(`<`, `>`);
}

// Returns [quote] of type "[quote]".
new CustomWrap().bbCode.wrap('quote');

// Returns <span> of type "<span>".
new CustomWrap().html.wrap('span');

// Checks the object type. Returns 'wrapper'.
const bbCodeWrapper = new Wrapper('[', ']');

// Returns 'wrapper'.
typeOf(bbCodeWrapper);

// Symbol.toStringTag is immutable. Can't be changed.
// Uncaught TypeError: Cannot set property Symbol(Symbol.toStringTag) of [object Object] which has only a getter
Object.assign(bbCodeWrapper, {
  [Symbol.toStringTag]: 'custom'
});

```


---

# 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/wrapper/benefits/explanation.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.
