Skip to content

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

Closed
wants to merge 4 commits into from
Closed

Add RegExp indices #46073

wants to merge 4 commits into from

Conversation

xiBread
Copy link

@xiBread xiBread commented Sep 26, 2021

Fixes #44227

@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Sep 26, 2021
@typescript-bot
Copy link
Collaborator

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.

Copy link
Contributor

@rbuckton rbuckton left a 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.

@ImUrX
Copy link

ImUrX commented Apr 5, 2022

any news?

@pagoru
Copy link

pagoru commented Nov 6, 2022

Come on...

@rbuckton
Copy link
Contributor

rbuckton commented Jan 3, 2023

Superseded by #52085

@rbuckton rbuckton closed this Jan 3, 2023
@xiBread xiBread deleted the regexp-indices branch January 3, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Node now supports Regexp hasIndices -- typescript does not.
6 participants