From 75b18ce8538ea8364728c30d0fceefbe0299f424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Jagie=C5=82=C5=82o?= Date: Thu, 13 Jul 2017 19:35:08 +0200 Subject: [PATCH] Add types for `XRegExp union` function to accept either `string[]` and `RegExp[]` --- types/xregexp/index.d.ts | 5 +++-- types/xregexp/xregexp-tests.ts | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/xregexp/index.d.ts b/types/xregexp/index.d.ts index 918c13e0b6..3974682fa0 100644 --- a/types/xregexp/index.d.ts +++ b/types/xregexp/index.d.ts @@ -2,6 +2,7 @@ // Project: http://xregexp.com // Definitions by: Bart van der Schoor , // Johannes Fahrenkrug +// Mateusz Jagiełło // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -83,7 +84,7 @@ declare namespace OuterXRegExp { function uninstall(options: Object): void; function uninstall(options: string): void; - function union(patterns: string[], flags?: string): RegExp; + function union(patterns: string[] | RegExp[], flags?: string): RegExp; var version: string; // end API definitions @@ -126,7 +127,7 @@ declare namespace OuterXRegExp { function uninstall(options: Object): void; function uninstall(options: string): void; - function union(patterns: string[], flags?: string): RegExp; + function union(patterns: string[] | RegExp[], flags?: string): RegExp; var version: string; // end API definitions } diff --git a/types/xregexp/xregexp-tests.ts b/types/xregexp/xregexp-tests.ts index b7328e5d12..543ceb7227 100644 --- a/types/xregexp/xregexp-tests.ts +++ b/types/xregexp/xregexp-tests.ts @@ -145,5 +145,7 @@ XRegExp.uninstall(str); regex = XRegExp.union(strArr, flags); regex = XRegExp.union(strArr); +regex = XRegExp.union(expArr, flags); +regex = XRegExp.union(expArr); // -- -- -- -- -- -- -- -- -- -- -- -- --