> For the complete documentation index, see [llms.txt](https://docs.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.angular-package.dev/wrapper/wrap/methods/instance/replaceclosing.md).

# ★ replaceClosing()

## `Wrap.prototype.replaceClosing()`

Returns the [primitive value](/wrapper/wrap/methods/instance/valueof.md) with replaced [`closing`](/wrapper/wrap/accessors/closing.md) 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`](/wrapper/wrap/accessors/closing.md) chars in the [primitive value](/wrapper/wrap/methods/instance/valueof.md).

### 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`](/wrapper/wrap/generic-type-variables.md#wrap-opening), [`Text`](https://docs.angular-package.dev/wrapper/wrap/methods/instance/pages/SYPkCWCkQnshiX32nwLt#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`](/wrapper/wrap/accessors/closing.md) chars of a generic type variables in order [`Opening`](/wrapper/wrap/generic-type-variables.md#wrap-opening), [`Text`](https://docs.angular-package.dev/wrapper/wrap/methods/instance/pages/SYPkCWCkQnshiX32nwLt#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('>');
```
