-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version:
3.7.2 (3.7.4 and nightly (3.8.0) as well)
Search Terms:
Named capture groups
Named capturing groups
Regex
ES2018.RegExp
Expected behavior:
The named capture group in the regex gets transpiled to the correct target (es5 in our case). Something like what @babel/plugin-transform-named-capturing-groups-regex does?
Actual behavior:
The named capture group ends up in the compiled code while only Chrome currently supports this.
Related Issues:
#31241
Code
const regex = /^(?<name>[A-Za-z]+)/;
const match = regex.exec('MatchThis-NotThis');
console.log(match);
Live Playground
Here
Additional information
I'm not 100% sure if this is something that TypeScript actually should be doing so if that's not the case I'd like to get some details on how to properly transpile this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript