diff --git a/src/lib/es2020.symbol.wellknown.d.ts b/src/lib/es2020.symbol.wellknown.d.ts index cdf0349f9b420..5c5142cca7fc9 100644 --- a/src/lib/es2020.symbol.wellknown.d.ts +++ b/src/lib/es2020.symbol.wellknown.d.ts @@ -21,3 +21,12 @@ interface RegExp { */ [Symbol.matchAll](str: string): RegExpStringIterator; } + +interface String { + /** + * Matches a string or an object that supports being matched against, and + * returns an iterable of matches containing the results of that search. + * @param regexp An object that supports being matched against. + */ + matchAll(matcher: { [Symbol.matchAll](str: string): RegExpStringIterator; }): RegExpStringIterator; +} diff --git a/src/lib/es2021.d.ts b/src/lib/es2021.d.ts index a70e09c1f5c0c..a14bde8663804 100644 --- a/src/lib/es2021.d.ts +++ b/src/lib/es2021.d.ts @@ -1,5 +1,6 @@ /// /// /// +/// /// /// diff --git a/src/lib/es2021.string.d.ts b/src/lib/es2021.string.d.ts index 66971bf84d6cf..a1fcc47069f32 100644 --- a/src/lib/es2021.string.d.ts +++ b/src/lib/es2021.string.d.ts @@ -1,14 +1,16 @@ +/// + interface String { /** * Replace all instances of a substring in a string, using a regular expression or search string. - * @param searchValue A string to search for. + * @param searchValue An object that supports searching for and replacing matches within a string. * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replaceAll(searchValue: string | RegExp, replaceValue: string): string; /** * Replace all instances of a substring in a string, using a regular expression or search string. - * @param searchValue A string to search for. + * @param searchValue An object that supports searching for and replacing matches within a string. * @param replacer A function that returns the replacement text. */ replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; diff --git a/src/lib/es2021.symbol.wellknown.d.ts b/src/lib/es2021.symbol.wellknown.d.ts new file mode 100644 index 0000000000000..dfae2c51c64ae --- /dev/null +++ b/src/lib/es2021.symbol.wellknown.d.ts @@ -0,0 +1,17 @@ +/// + +interface String { + /** + * Replace all instances of a substring in a string, using an object that supports replacement within a string. + * @param searchValue A string to search for. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replaceAll(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replace all instances of a substring in a string, using an object that supports replacement within a string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replaceAll(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; +}