diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2398b8d43..d661839d5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5669,18 +5669,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 64b4da950..4e86afb66 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9621,6 +9621,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; @@ -9633,6 +9634,13 @@ declare module _ { isRegExp(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): LoDashExplicitWrapper; + } + //_.isString interface LoDashStatic { /**