From fd74874733a20e1f433cc37229152eddea81c1d1 Mon Sep 17 00:00:00 2001 From: Nil Admirari <50202386+nihil-admirari@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:51:08 +0000 Subject: [PATCH] String#matchAll should return iterable of RegExpExecArray (fixes #36788) (#55565) Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> --- src/lib/es2020.string.d.ts | 2 +- .../baselines/reference/stringMatchAll.types | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lib/es2020.string.d.ts b/src/lib/es2020.string.d.ts index 1602ac7b10f..bc7cf1ad5f7 100644 --- a/src/lib/es2020.string.d.ts +++ b/src/lib/es2020.string.d.ts @@ -6,7 +6,7 @@ interface String { * containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - matchAll(regexp: RegExp): IterableIterator; + matchAll(regexp: RegExp): IterableIterator; /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ toLocaleLowerCase(locales?: Intl.LocalesArgument): string; diff --git a/tests/baselines/reference/stringMatchAll.types b/tests/baselines/reference/stringMatchAll.types index 59c112f5016..9386da13c84 100644 --- a/tests/baselines/reference/stringMatchAll.types +++ b/tests/baselines/reference/stringMatchAll.types @@ -2,23 +2,23 @@ === stringMatchAll.ts === const matches = "matchAll".matchAll(/\w/g); ->matches : IterableIterator ->"matchAll".matchAll(/\w/g) : IterableIterator ->"matchAll".matchAll : (regexp: RegExp) => IterableIterator +>matches : IterableIterator +>"matchAll".matchAll(/\w/g) : IterableIterator +>"matchAll".matchAll : (regexp: RegExp) => IterableIterator >"matchAll" : "matchAll" ->matchAll : (regexp: RegExp) => IterableIterator +>matchAll : (regexp: RegExp) => IterableIterator >/\w/g : RegExp const array = [...matches]; ->array : RegExpMatchArray[] ->[...matches] : RegExpMatchArray[] ->...matches : RegExpMatchArray ->matches : IterableIterator +>array : RegExpExecArray[] +>[...matches] : RegExpExecArray[] +>...matches : RegExpExecArray +>matches : IterableIterator const { index, input } = array[0]; >index : number >input : string ->array[0] : RegExpMatchArray ->array : RegExpMatchArray[] +>array[0] : RegExpExecArray +>array : RegExpExecArray[] >0 : 0