# StringOfLength

## `StringOfLength<Min, Max, Type>`

A [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type or an instance of [`String`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) of length between a specified range takes generic type variable [`Min`](#minextendsnumber) and [`Max`](#max-extends-number) constrained by [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type as length, and takes generic type variable [`Type`](#typeextendsanystring-string) constrained by generic type [`AnyString`](/type/anystring.md) as the type.

{% code title="string-of-length.type.ts" %}

```typescript
type StringOfLength<
  Min extends number,
  Max extends number,
  Type extends AnyString = string
> = Type & MinMax<Min, Max>;
```

{% endcode %}

### Generic type variables

#### <mark style="color:green;">`Min`</mark>`extends`<mark style="color:green;">`number`</mark>

A generic type variable `Min` constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type indicates the **minimum** length of the generic type variable [`Type`](#typeextendsanystring-string).

#### <mark style="color:green;">`Max`</mark>`extends`<mark style="color:green;">`number`</mark>

A generic type variable `Max` constrained by the [`number`](https://www.typescriptlang.org/docs/handbook/basic-types.html#number) type indicates the **maximum** length of the generic type variable [`Type`](#typeextendsanystring-string).

#### <mark style="color:green;">`Type`</mark>`extends`<mark style="color:green;">`AnyString`</mark>`=`<mark style="color:green;">`string`</mark>

A generic type variable `Type` constrained by generic type [`AnyString`](/type/anystring.md) indicates [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type.


---

# 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://type.angular-package.dev/type/stringoflength.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.
