From 312df84934204e6683456c131d7ed8b420425082 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 19 Aug 2015 15:06:10 -0700 Subject: [PATCH] Added overload for 'String#search' to take objects with '[Symbol.search]' method. --- src/lib/es6.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index fddf9db79a..e9a23cc2ee 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -429,9 +429,9 @@ interface String { /** * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param regexpLike An object that supports being matched against. + * @param matcher An object that supports being matched against. */ - match(regexpLike: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; + match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; /** * Replaces text in a string, using an object that supports replacement within a string. @@ -447,6 +447,12 @@ interface String { */ replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + /** * Returns an HTML anchor element and sets the name attribute to the text value * @param name