From a98adefd006d7b2d8dc93d31eff77d7600e80779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Thu, 2 Apr 2020 00:25:16 +0100 Subject: [PATCH] Add replacer function overload for replaceAll (#37476) --- src/lib/esnext.string.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/esnext.string.d.ts b/src/lib/esnext.string.d.ts index c13d3e48a37..66971bf84d6 100644 --- a/src/lib/esnext.string.d.ts +++ b/src/lib/esnext.string.d.ts @@ -5,4 +5,11 @@ interface 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 replacer A function that returns the replacement text. + */ + replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }