# define()

## `Wrapper.define()`

Defines a new [`Wrapper`](/wrapper/overview.md) instance with the provided [`opening`](#opening-opening), [`closing`](#closing-closing) chars, and optional [`text`](#text-text).

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

```typescript
public static define<
  Opening extends string,
  Closing extends string,
  Text extends string = ''
>(
  opening: Opening,
  closing: Closing,
  text?: Text
): Wrapper<Opening, Text, Closing> {
  return new this(opening, closing, text);
}
```

{% endcode %}

### Generic type variables

#### <mark style="color:green;">**`Opening`**</mark>**`extends`**<mark style="color:green;">**`string`**</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 [`opening`](#opening-opening) indicates the type of the opening in the [`Wrapper`](/wrapper/overview.md) via [return type](#return-type).

#### <mark style="color:green;">**`Closing`**</mark>**`extends`**<mark style="color:green;">**`string`**</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-closing) indicates the type of the closing in the [`Wrapper`](/wrapper/overview.md) via [return type](#return-type).

#### <mark style="color:green;">**`Text`**</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 [`text`](#text-text) indicates the type of the text in the [`Wrapper`](/wrapper/overview.md) via [return type](#return-type).

### Parameters

#### `opening: Opening`

The **opening** chars of generic type variable [`Opening`](#openingextendsstring) for new [`Wrapper`](/wrapper/overview.md) instance.

#### `closing: Closing`

The **closing** chars of generic type variable [`Closing`](#closingextendsstring) for new [`Wrapper`](/wrapper/overview.md) instance.

#### `text?: Text`

An optional **text** of generic type variable [`Text`](#textextendsstring) for new [`Wrapper`](/wrapper/overview.md) instance.

### Return type

#### `Wrapper<Opening, Text, Closing>`

The **return type** is the [`Wrapper`](/wrapper/overview.md) object that takes generic type variables [`Opening`](#openingextendsstring), [`Text`](#textextendsstring), and [`Closing`](#closingextendsstring).

### Returns

The **return value** is the [`Wrapper`](/wrapper/overview.md) instance of given [`opening`](#opening-opening), [`closing`](#closing-closing) chars, and optional [`text`](#text-text).

## Example usage

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

// Returns Wrapper {'()'}
// of type Wrapper<"(", "", ")">
Wrapper.define('(', ')');

// Returns Wrapper {'!!'}
// of type Wrapper<"!", "", "!">
Wrapper.define('!', '!');

// Returns Wrapper {'"This is quoted text"'}
// of type Wrapper<"\"", "This is quoted text", "\"">
Wrapper.define('"', '"', 'This is quoted text');
```


---

# 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://wrapper.angular-package.dev/wrapper/methods/static/define.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.
