Type Parameters
- S extends string
- Length extends ArgStr
Returns s is string & Readonly<
{
MaxLength: RelaxedExclude<
IndexOfTupleImpl<
[...MakeTupleImpl<0, `${Length}`, []>[], 0],
keyof [...MakeTupleImpl<0, `${Length}`, []>[], 0],
>,
never,
>;
},
> & Readonly<
{
"TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3": unknown;
},
> & Readonly<{ MinLength: readonly [MakeTupleImpl<0, `${Length}`, []>, 0] }> & S
true if s.length === length, false otherwise. When true,
TypeScript narrows s to FixedLengthString<Length> & S.
Type guard that checks if a string has exactly
lengthcharacters.The length is measured in UTF-16 code units (the same unit as
String.prototype.length), so characters outside the Basic Multilingual Plane (e.g. emoji) count as 2.Type Narrowing Behavior:
FixedLengthString<Length>while preserving the original string type (e.g. literal types) via intersection.FixedLengthString<Length>is defined asBoundedLengthString<Length, Length>, the narrowed value is assignable to anyMinLengthString<N>withN <= Lengthand anyMaxLengthString<N>withN >= Length.