Branded string type for strings with exactly Length characters. Alias for BoundedLengthString<Length, Length>.
Length
BoundedLengthString<Length, Length>
The exact number of characters. Must be a non-negative integer literal.
const countryCode = 'JP' as FixedLengthString<2>;const atMost5: MaxLengthString<5> = countryCode; // OK (2 <= 5)const nonEmpty: MinLengthString<1> = countryCode; // OK (2 >= 1)// const threeChars: FixedLengthString<3> = countryCode; // Error! Copy
const countryCode = 'JP' as FixedLengthString<2>;const atMost5: MaxLengthString<5> = countryCode; // OK (2 <= 5)const nonEmpty: MinLengthString<1> = countryCode; // OK (2 >= 1)// const threeChars: FixedLengthString<3> = countryCode; // Error!
Branded string type for strings with exactly
Lengthcharacters. Alias forBoundedLengthString<Length, Length>.