# ★ replaceClosing()

## `Wrap.prototype.replaceClosing()`

Returns the [primitive value](https://wrapper.angular-package.dev/wrap/methods/instance/valueof) with replaced [`closing`](https://wrapper.angular-package.dev/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://wrapper.angular-package.dev/wrap/accessors/closing) chars in the [primitive value](https://wrapper.angular-package.dev/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://wrapper.angular-package.dev/generic-type-variables#wrap-opening), [`Text`](https://wrapper.angular-package.dev/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://wrapper.angular-package.dev/wrap/accessors/closing) chars of a generic type variables in order [`Opening`](https://wrapper.angular-package.dev/generic-type-variables#wrap-opening), [`Text`](https://wrapper.angular-package.dev/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('>');
```
