You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regexp named capture groups have been added to the ECMA spec. It would be great if typescript could compile these down based on the desired target. Babel already has a plugin to do so:
Argh, my bad. It looks like you already do this. I had an error I thought was failure to downlevel these named capture groups, but I was wrong. Sorry! 😬
@jaredh159, do you, by any chance, remember what issue caused this for you back then?
I'm working on a project which has es2018 in the compilerOptions.libs array in tsconfig.js and es5 as compilerOptions.target but the compiled files still contain named capture groups.
This is an example of the regex that shows this issue:
@cascornelissen I can't remember, honestly, sorry. I know I was used named capture groups and was getting an error in Safari I think, so I assumed they weren't being transpiled, but I jumped the gun and I had some mostly unrelated other problem that just happened to crop up at the same time that I started using named capture groups, IIRC.
Search Terms
"named capture"
regexp named capture groups
Suggestion
Regexp named capture groups have been added to the ECMA spec. It would be great if typescript could compile these down based on the desired target. Babel already has a plugin to do so:
babel/proposals#35
babel/babel#9345
tc39/ecma262#1027
Use Cases
Writing next-level javascript regular expressions! 😎
And because it's a great feature for readable, maintainable code, and is in the spec.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: