Skip to content
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

@internationalized: named regexp capture groups cause build failure in TypeScript 5.5 #6366

Open
Renegade334 opened this issue May 11, 2024 · 0 comments · May be fixed by #6370
Open

@internationalized: named regexp capture groups cause build failure in TypeScript 5.5 #6366

Renegade334 opened this issue May 11, 2024 · 0 comments · May be fixed by #6370

Comments

@Renegade334
Copy link
Contributor

Renegade334 commented May 11, 2024

Provide a general summary of the issue here

Related: #4542

Currently, the regular expression DATE_TIME_DURATION_RE in date/src/string.ts uses named capture groups, which are then subsequently referenced as match.groups....

This syntax was not supported prior to ES2018, and the upcoming TypeScript 5.5 release adds checks to validate regular expression flags and syntax against the build target. The result is error TS1503: Named capturing groups are only available when targeting 'ES2018' or later., causing the build to fail.

💁 Possible Solution

There are two resolution options:

  1. Update the project's build target to ES2018 (or ESNext etc.)
  2. Remove the named capture group syntax from DATE_TIME_DURATION_RE, and reference the matched groups by index rather than by group name (ie. match[...] rather than match.groups...). This is already the approach used with the other regular expressions in string.ts.
@snowystinger snowystinger linked a pull request May 13, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants