The minimum number of characters (inclusive). Must be a non-negative integer literal.
The maximum number of characters (inclusive). Must be a non-negative integer literal.
const userId = 'user-12345678' as BoundedLengthString<8, 16>;
const relaxed: BoundedLengthString<1, 255> = userId; // OK ([8, 16] ⊆ [1, 255])
const atLeast8: MinLengthString<8> = userId; // OK
const atMost16: MaxLengthString<16> = userId; // OK
// const strict: BoundedLengthString<10, 16> = userId; // Error! (8 < 10)
Branded string type for strings whose length is between
MinLengthandMaxLengthcharacters (both inclusive). Defined as the intersection of MinLengthString and MaxLengthString, so both bounds can be weakened independently:BoundedLengthString<M1, M2>is assignable toBoundedLengthString<N1, N2>ifM1 >= N1andM2 <= N2.