diff --git a/src/lib/core.d.ts b/src/lib/core.d.ts index 442921ca5a4..bffdac3a3e2 100644 --- a/src/lib/core.d.ts +++ b/src/lib/core.d.ts @@ -324,9 +324,9 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A function that returns the replacement text. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; /** * Replaces text in a string, using a regular expression or search string. @@ -338,9 +338,9 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A function that returns the replacement text. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; /** * Finds the first substring match in a regular expression search. diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index 767060f9848..aceac270f88 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -685,6 +685,23 @@ interface RegExp { */ [Symbol.match](str: string): RegExpMatchArray; + /** + * Replaces text in a string, using a regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + /** * Returns a string indicating the flags of the regular expression in question. This field is read-only. * The characters in this string are sequenced and concatenated in the following order: