diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2d244b16e..f493b4260 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5635,18 +5635,34 @@ result = _([]).isPlainObject(); result = _({}).isPlainObject(); // _.isRegExp -result = _.isRegExp(any); -result = _(1).isRegExp(); -result = _([]).isRegExp(); -result = _({}).isRegExp(); -{ - let value: RegExp|string = /^foo$/g; - if (_.isRegExp(value)) { - let regex: RegExp = value; - let index: number = value.exec("foo").index; - } else { - let result: string = value; - } +module TestIsRegExp { + { + let value: number|RegExp; + + if (_.isRegExp(value)) { + let result: RegExp = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isRegExp(any); + result = _(1).isRegExp(); + result = _([]).isRegExp(); + result = _({}).isRegExp(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isRegExp(); + result = _([]).chain().isRegExp(); + result = _({}).chain().isRegExp(); + } } // _.isString diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8425f1d82..350757ded 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9605,6 +9605,7 @@ declare module _ { /** * Checks if value is classified as a RegExp object. * @param value The value to check. + * * @return Returns true if value is correctly classified, else false. */ isRegExp(value?: any): value is RegExp; @@ -9617,6 +9618,13 @@ declare module _ { isRegExp(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): LoDashExplicitWrapper; + } + //_.isString interface LoDashStatic { /**