Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/string.prototype.matchall/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @param str string to match
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
*/
declare function matchAll(str: string, regexp: string | RegExp): IterableIterator<RegExpMatchArray>;
declare function matchAll(str: string, regexp: string | RegExp): IterableIterator<RegExpExecArray>;

declare namespace matchAll {
function shim(): void;
Expand Down
1 change: 1 addition & 0 deletions types/string.prototype.matchall/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"private": true,
"name": "@types/string.prototype.matchall",
"minimumTypeScriptVersion": "5.4",
"version": "4.0.9999",
"projects": [
"https://github.com/ljharb/String.prototype.matchAll#readme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const str = "aabc";
const nonRegexStr = "ab";
const globalRegex = /[ac]/g;

matchAll(str, nonRegexStr); // $ExpectType IterableIterator<RegExpMatchArray>
matchAll(str, new RegExp(nonRegexStr, "g")); // $ExpectType IterableIterator<RegExpMatchArray>
matchAll(str, globalRegex); // $ExpectType IterableIterator<RegExpMatchArray>
matchAll(str, nonRegexStr); // $ExpectType IterableIterator<RegExpExecArray>
matchAll(str, new RegExp(nonRegexStr, "g")); // $ExpectType IterableIterator<RegExpExecArray>
matchAll(str, globalRegex); // $ExpectType IterableIterator<RegExpExecArray>
matchAll.shim(); // $ExpectType void
str.matchAll(globalRegex); // $ExpectType IterableIterator<RegExpMatchArray>
str.matchAll(new RegExp(nonRegexStr, "g")); // $ExpectType IterableIterator<RegExpMatchArray>
str.matchAll(globalRegex); // $ExpectType IterableIterator<RegExpExecArray>
str.matchAll(new RegExp(nonRegexStr, "g")); // $ExpectType IterableIterator<RegExpExecArray>