# ★ replaceClosing()

## `Wrap.prototype.replaceClosing()`

Returns the [primitive value](https://docs.angular-package.dev/wrapper/wrap/methods/instance/valueof) with replaced [`closing`](https://docs.angular-package.dev/wrapper/wrap/accessors/closing) chars.

{% code title="wrap.class.ts" %}

```typescript
public replaceClosing<ReplaceClosing extends string = ''>(
  closing: ReplaceClosing
): `${Opening}${Text}${ReplaceClosing}` {
  return `${this.#opening}${this.#text}${String(closing) as ReplaceClosing}`;
}
```

{% endcode %}

### Generic type variables

#### <mark style="color:green;">**`ReplaceClosing`**</mark>**`extends`**<mark style="color:green;">**`string`**</mark>**`=`**<mark style="color:green;">**`''`**</mark>

A generic type variable constrained by the [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string), by default of the value captured from the provided [`closing`](#closing-replaceclosing) indicates the `ReplaceClosing` type on the template of the [return type](#return-type).

### Parameters

#### `closing: replaceClosing`

The closing chars of a generic type variable [`ReplaceClosing`](#replaceclosingextendsstring) to replace the [`closing`](https://docs.angular-package.dev/wrapper/wrap/accessors/closing) chars in the [primitive value](https://docs.angular-package.dev/wrapper/wrap/methods/instance/valueof).

### Return type

#### `${Opening}${Text}${ReplaceClosing}`

The **return type** is [template literal](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html) of generic type variables in order [`Opening`](https://docs.angular-package.dev/wrapper/generic-type-variables#wrap-opening), [`Text`](https://docs.angular-package.dev/wrapper/generic-type-variables#wrap-less-than...-text-...greater-than) and [`ReplaceClosing`](#replaceclosingextendsstring).

### Returns

The **return value** is the [primitive value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/valueOf) with replaced [`closing`](https://docs.angular-package.dev/wrapper/wrap/accessors/closing) chars of a generic type variables in order [`Opening`](https://docs.angular-package.dev/wrapper/generic-type-variables#wrap-opening), [`Text`](https://docs.angular-package.dev/wrapper/generic-type-variables#wrap-less-than...-text-...greater-than) and [`ReplaceClosing`](#replaceclosingextendsstring) on the template.

## Example usage

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

// Returns [quote}} of type "[quote}}".
new Wrap(`[`, `]`, 'quote').replaceClosing('}}');

// Returns [quote}} of "[quote}}".
new Wrap(`[`, ``, 'quote').replaceClosing('}}');

// Returns [quote> of "[quote>".
new Wrap(`[`, ``, 'quote').replaceClosing('>');
```


---

# 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/wrap/methods/instance/replaceclosing.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.
