Skip to content

Commit 8e8f512

Browse files
committed
Add optional index and output to String.match
1 parent 39921a0 commit 8e8f512

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/core.d.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,13 @@ interface String {
302302
* Matches a string with a regular expression, and returns an array containing the results of that search.
303303
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
304304
*/
305-
match(regexp: string): string[];
305+
match(regexp: string): RegExpMatchArray;
306306

307307
/**
308308
* Matches a string with a regular expression, and returns an array containing the results of that search.
309309
* @param regexp A regular expression object that contains the regular expression pattern and applicable flags.
310310
*/
311-
match(regexp: RegExp): string[];
311+
match(regexp: RegExp): RegExpMatchArray;
312312

313313
/**
314314
* Replaces text in a string, using a regular expression or search string.
@@ -775,12 +775,16 @@ declare var Date: {
775775
now(): number;
776776
}
777777

778+
interface RegExpMatchArray extends Array<string> {
779+
index?: number;
780+
input?: string;
781+
}
782+
778783
interface RegExpExecArray extends Array<string> {
779784
index: number;
780785
input: string;
781786
}
782787

783-
784788
interface RegExp {
785789
/**
786790
* Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.

0 commit comments

Comments
 (0)