Types
ClosingTag<Name, Opening, Closing>
ClosingTag<Name, Opening, Closing>The generic type ClosingTag indicates the closing tag. It takes the tag name of a generic type variable Name constrained by the string and wrap of a generic type variable Chars constrained by generic type StringOfLength of two chars.
type ClosingTag<
Name extends string,
Chars extends StringOfLength<2, 2, string>
> = StringOfLength<0, typeof Infinity, `${Chars[0]}/${Name}${Chars[1]}`>;OpeningTag<Name, Opening, Closing>
OpeningTag<Name, Opening, Closing>The generic type OpeningTag indicates the type of closing tag. It takes the tag name of a generic type variable Name constrained by the string and wrap of a generic type variable Chars constrained by generic type StringOfLength of two chars.
type OpeningTag<
Name extends string,
Chars extends StringOfLength<2, 2, string>
> = StringOfLength<0, typeof Infinity, `${Chars[0]}${Name}${Chars[1]}`>;TaggedText<Text, Name, Opening, Closing>
TaggedText<Text, Name, Opening, Closing>The generic type TaggedText indicates the type of tagged text, with the opening tag and closing tag of the text.
type TaggedText<Text extends string, Name extends string, Chars extends string> =
`${OpeningTag<Name, Chars>}${Text}${ClosingTag<Name, Chars>}`;Last updated
Was this helpful?