-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add RegExp indices #46073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RegExp indices #46073
Conversation
The TypeScript team hasn't accepted the linked issue #44227. If you can get it accepted, this PR will have a better chance of being reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should be more pedantic here or not. [number, number] | undefined
is a more accurate type, since a failed capture in an alternative can produce undefined:
const match = /(a)|(b)/d.exec("b")
match.indices[1]; // undefined
match.indices[2]; // [0, 1]
However, we use string
instead of string | undefined
in RegExpExecArray
, so maybe this is fine.
any news? |
Come on... |
Superseded by #52085 |
Fixes #44227