typed-regex
typed-regex copied to clipboard
Bug: If a capture group is part of an optional parent group it is not marked as optional
Current:
const regex = TypedRegEx("^\w+(@(?<version>[a-z0-9-_.]+))?$", "gi");
const captures = regex.captures(...); // { version: string } | undefined;
Expected:
const regex = TypedRegEx("^\w+(@(?<version>[a-z0-9-_.]+))?$", "gi");
const captures = regex.captures(...); // { version?: string | undefined } | undefined;