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
This is the behavior in every version I tried, and I reviewed the FAQ for entries about RegExp, matchAll, Symbol.matchAll, RegExpExecArray, RegExpMatchArray
constre=/./gconststr='abc'for(constmofstr.matchAll(re)){// ok (expected result)consti: number=m.index}for(constmofre[Symbol.matchAll](str)){// Type 'number | undefined' is not assignable to type 'number'.consti: number=m.index}
🙁 Actual behavior
While String#matchAll now correctly returns RegExpStringIterator<RegExpExecArray> (#36788, fixed in #55565), the identically-behaving RegExp#[Symbol.matchAll] still returns the incorrect type RegExpStringIterator<RegExpMatchArray>
🙂 Expected behavior
String#matchAll and RegExp#[Symbol.matchAll] to behave identically at compile time as well as runtime, i.e. both String#matchAll and RegExp#[Symbol.matchAll] to consistently return RegExpStringIterator<RegExpExecArray>.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
🔎 Search Terms
RegExp, matchAll, Symbol.matchAll, RegExpExecArray, RegExpMatchArray
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?target=99#code/MYewdgzgLgBATgUxgXhgegHRoOYChSSzRwowDkAhgEbBm64BmIJAFAdDALYwgMzEZOFKMAAWAQQA2klogCUcmAG9cMNejQ8A1jBYIAHgAcEwKAgAm8BBACukqHNXr2sAJYAuGGBucqCEqicGK5g5gbqMLgAvvRMrC5cPHyIANoAygCeviCSgsJiUpIAuizECspOamiaACoZxuTevv4wAD4wNqEIDCEWZDCuEF4gsBQQEK7YYNSSSFAgMFD1SGRNfnBkGJUwCR5ePuukQSFh+tG4QA
💻 Code
🙁 Actual behavior
While
String#matchAll
now correctly returnsRegExpStringIterator<RegExpExecArray>
(#36788, fixed in #55565), the identically-behavingRegExp#[Symbol.matchAll]
still returns the incorrect typeRegExpStringIterator<RegExpMatchArray>
🙂 Expected behavior
String#matchAll
andRegExp#[Symbol.matchAll]
to behave identically at compile time as well as runtime, i.e. bothString#matchAll
andRegExp#[Symbol.matchAll]
to consistently returnRegExpStringIterator<RegExpExecArray>
.Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: