Skip to content

Commit

Permalink
Return iterable of RegExpExecArray from RegExp#[Symbol.matchAll]
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel-rowe committed Nov 16, 2024
1 parent b3c67d3 commit 2fe6cd8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lib/es2020.symbol.wellknown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ interface RegExp {
* containing the results of that search.
* @param string A string to search within.
*/
[Symbol.matchAll](str: string): RegExpStringIterator<RegExpMatchArray>;
[Symbol.matchAll](str: string): RegExpStringIterator<RegExpExecArray>;
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/regexMatchAll-esnext.types
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

=== regexMatchAll-esnext.ts ===
const matches = /\w/g[Symbol.matchAll]("matchAll");
>matches : RegExpStringIterator<RegExpMatchArray>
>matches : RegExpStringIterator<RegExpExecArray>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>/\w/g[Symbol.matchAll]("matchAll") : RegExpStringIterator<RegExpMatchArray>
>/\w/g[Symbol.matchAll]("matchAll") : RegExpStringIterator<RegExpExecArray>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>/\w/g[Symbol.matchAll] : (str: string) => RegExpStringIterator<RegExpMatchArray>
>/\w/g[Symbol.matchAll] : (str: string) => RegExpStringIterator<RegExpExecArray>
> : ^ ^^ ^^^^^
>/\w/g : RegExp
> : ^^^^^^
Expand All @@ -26,7 +26,7 @@ const array = [...matches];
> : ^^^^^^^^^^^^^^^^^^
>...matches : RegExpMatchArray
> : ^^^^^^^^^^^^^^^^
>matches : RegExpStringIterator<RegExpMatchArray>
>matches : RegExpStringIterator<RegExpExecArray>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

const { index, input } = array[0];
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/regexMatchAll.types
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

=== regexMatchAll.ts ===
const matches = /\w/g[Symbol.matchAll]("matchAll");
>matches : RegExpStringIterator<RegExpMatchArray>
>matches : RegExpStringIterator<RegExpExecArray>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>/\w/g[Symbol.matchAll]("matchAll") : RegExpStringIterator<RegExpMatchArray>
>/\w/g[Symbol.matchAll]("matchAll") : RegExpStringIterator<RegExpExecArray>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>/\w/g[Symbol.matchAll] : (str: string) => RegExpStringIterator<RegExpMatchArray>
>/\w/g[Symbol.matchAll] : (str: string) => RegExpStringIterator<RegExpExecArray>
> : ^ ^^ ^^^^^
>/\w/g : RegExp
> : ^^^^^^
Expand All @@ -26,7 +26,7 @@ const array = [...matches];
> : ^^^^^^^^^^^^^^^^^^
>...matches : RegExpMatchArray
> : ^^^^^^^^^^^^^^^^
>matches : RegExpStringIterator<RegExpMatchArray>
>matches : RegExpStringIterator<RegExpExecArray>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

const { index, input } = array[0];
Expand Down

0 comments on commit 2fe6cd8

Please sign in to comment.