-
-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Feature Request
Problem
The tags.Pattern type does not support regex flags. This prevents using Unicode property escapes (\p{ID_Start}, \p{ID_Continue}) which require the u flag.
Use Case
Validating ECMAScript identifiers per UAX #31 requires Unicode property escapes:
// Standard JavaScript approach
const pattern = /^[\p{ID_Start}_$][\p{ID_Continue}_$]*$/u;
// With typia - no way to specify the 'u' flag
type Identifier = string & tags.Pattern<"^[\\p{ID_Start}_$][\\p{ID_Continue}_$]*$">;Current Workaround
Manually expand all Unicode character ranges from DerivedCoreProperties.txt:
const ID_Start = [
"\\u0041-\\u005A", // Latin uppercase
"\\u0061-\\u007A", // Latin lowercase
"\\u00C0-\\u00D6", // Latin Extended
// ... 448 ranges total for full BMP coverage
].join("");
type Identifier = string & tags.Pattern<`^[_$${typeof ID_Start}][_$0-9${typeof ID_Start}]*$`>;This workaround:
- Produces unreadable generated code
- Cannot cover astral planes (characters > U+FFFF)
- Requires manual updates when Unicode standard changes
Metadata
Metadata
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers