StringOfLength

StringOfLength<Min, Max, Type>

A string type or an instance of String of length between a specified range takes generic type variable Min and Max constrained by number type as length, and takes generic type variable Type constrained by generic type AnyString as the type.

string-of-length.type.ts
type StringOfLength<
  Min extends number,
  Max extends number,
  Type extends AnyString = string
> = Type & MinMax<Min, Max>;

Generic type variables

Minextendsnumber

A generic type variable Min constrained by the number type indicates the minimum length of the generic type variable Type.

Maxextendsnumber

A generic type variable Max constrained by the number type indicates the maximum length of the generic type variable Type.

TypeextendsAnyString=string

A generic type variable Type constrained by generic type AnyString indicates string type.

Last updated