Skip to content

Commit 11944f3

Browse files
committed
Return iterable of RegExpExecArray from RegExp#[Symbol.matchAll]
1 parent b3c67d3 commit 11944f3

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

src/lib/es2020.symbol.wellknown.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ interface RegExp {
1919
* containing the results of that search.
2020
* @param string A string to search within.
2121
*/
22-
[Symbol.matchAll](str: string): RegExpStringIterator<RegExpMatchArray>;
22+
[Symbol.matchAll](str: string): RegExpStringIterator<RegExpExecArray>;
2323
}

tests/baselines/reference/regexMatchAll-esnext.types

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
=== regexMatchAll-esnext.ts ===
44
const matches = /\w/g[Symbol.matchAll]("matchAll");
5-
>matches : RegExpStringIterator<RegExpMatchArray>
6-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7-
>/\w/g[Symbol.matchAll]("matchAll") : RegExpStringIterator<RegExpMatchArray>
8-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9-
>/\w/g[Symbol.matchAll] : (str: string) => RegExpStringIterator<RegExpMatchArray>
10-
> : ^ ^^ ^^^^^
5+
>matches : RegExpStringIterator<RegExpExecArray>
6+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7+
>/\w/g[Symbol.matchAll]("matchAll") : RegExpStringIterator<RegExpExecArray>
8+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9+
>/\w/g[Symbol.matchAll] : (str: string) => RegExpStringIterator<RegExpExecArray>
10+
> : ^ ^^ ^^^^^
1111
>/\w/g : RegExp
1212
> : ^^^^^^
1313
>Symbol.matchAll : unique symbol
@@ -20,24 +20,24 @@ const matches = /\w/g[Symbol.matchAll]("matchAll");
2020
> : ^^^^^^^^^^
2121

2222
const array = [...matches];
23-
>array : RegExpMatchArray[]
24-
> : ^^^^^^^^^^^^^^^^^^
25-
>[...matches] : RegExpMatchArray[]
26-
> : ^^^^^^^^^^^^^^^^^^
27-
>...matches : RegExpMatchArray
28-
> : ^^^^^^^^^^^^^^^^
29-
>matches : RegExpStringIterator<RegExpMatchArray>
30-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23+
>array : RegExpExecArray[]
24+
> : ^^^^^^^^^^^^^^^^^
25+
>[...matches] : RegExpExecArray[]
26+
> : ^^^^^^^^^^^^^^^^^
27+
>...matches : RegExpExecArray
28+
> : ^^^^^^^^^^^^^^^
29+
>matches : RegExpStringIterator<RegExpExecArray>
30+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3131

3232
const { index, input } = array[0];
3333
>index : number
3434
> : ^^^^^^
3535
>input : string
3636
> : ^^^^^^
37-
>array[0] : RegExpMatchArray
38-
> : ^^^^^^^^^^^^^^^^
39-
>array : RegExpMatchArray[]
40-
> : ^^^^^^^^^^^^^^^^^^
37+
>array[0] : RegExpExecArray
38+
> : ^^^^^^^^^^^^^^^
39+
>array : RegExpExecArray[]
40+
> : ^^^^^^^^^^^^^^^^^
4141
>0 : 0
4242
> : ^
4343

tests/baselines/reference/regexMatchAll.types

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
=== regexMatchAll.ts ===
44
const matches = /\w/g[Symbol.matchAll]("matchAll");
5-
>matches : RegExpStringIterator<RegExpMatchArray>
6-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7-
>/\w/g[Symbol.matchAll]("matchAll") : RegExpStringIterator<RegExpMatchArray>
8-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9-
>/\w/g[Symbol.matchAll] : (str: string) => RegExpStringIterator<RegExpMatchArray>
10-
> : ^ ^^ ^^^^^
5+
>matches : RegExpStringIterator<RegExpExecArray>
6+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7+
>/\w/g[Symbol.matchAll]("matchAll") : RegExpStringIterator<RegExpExecArray>
8+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9+
>/\w/g[Symbol.matchAll] : (str: string) => RegExpStringIterator<RegExpExecArray>
10+
> : ^ ^^ ^^^^^
1111
>/\w/g : RegExp
1212
> : ^^^^^^
1313
>Symbol.matchAll : unique symbol
@@ -20,24 +20,24 @@ const matches = /\w/g[Symbol.matchAll]("matchAll");
2020
> : ^^^^^^^^^^
2121

2222
const array = [...matches];
23-
>array : RegExpMatchArray[]
24-
> : ^^^^^^^^^^^^^^^^^^
25-
>[...matches] : RegExpMatchArray[]
26-
> : ^^^^^^^^^^^^^^^^^^
27-
>...matches : RegExpMatchArray
28-
> : ^^^^^^^^^^^^^^^^
29-
>matches : RegExpStringIterator<RegExpMatchArray>
30-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23+
>array : RegExpExecArray[]
24+
> : ^^^^^^^^^^^^^^^^^
25+
>[...matches] : RegExpExecArray[]
26+
> : ^^^^^^^^^^^^^^^^^
27+
>...matches : RegExpExecArray
28+
> : ^^^^^^^^^^^^^^^
29+
>matches : RegExpStringIterator<RegExpExecArray>
30+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3131

3232
const { index, input } = array[0];
3333
>index : number
3434
> : ^^^^^^
3535
>input : string
3636
> : ^^^^^^
37-
>array[0] : RegExpMatchArray
38-
> : ^^^^^^^^^^^^^^^^
39-
>array : RegExpMatchArray[]
40-
> : ^^^^^^^^^^^^^^^^^^
37+
>array[0] : RegExpExecArray
38+
> : ^^^^^^^^^^^^^^^
39+
>array : RegExpExecArray[]
40+
> : ^^^^^^^^^^^^^^^^^
4141
>0 : 0
4242
> : ^
4343

0 commit comments

Comments
 (0)