diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 8a47a41f12..b613146c4c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3988,10 +3988,24 @@ result = _.unescape('fred, barney, & pebbles'); result = _('fred, barney, & pebbles').unescape(); // _.words -result = _.words('fred, barney, & pebbles'); -result = _.words('fred, barney, & pebbles', /[^, ]+/g); -result = _('fred, barney, & pebbles').words(); -result = _('fred, barney, & pebbles').words(/[^, ]+/g); +module TestWords { + { + let result: string[]; + + result = _.words('fred, barney, & pebbles'); + result = _.words('fred, barney, & pebbles', /[^, ]+/g); + + result = _('fred, barney, & pebbles').words(); + result = _('fred, barney, & pebbles').words(/[^, ]+/g); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('fred, barney, & pebbles').chain().words(); + result = _('fred, barney, & pebbles').chain().words(/[^, ]+/g); + } +} /*********** * Utility * diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 528356ff24..e57e4c5c2c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9638,11 +9638,15 @@ declare module _ { interface LoDashStatic { /** * Splits string into an array of its words. + * * @param string The string to inspect. * @param pattern The pattern to match words. * @return Returns the words of string. */ - words(string?: string, pattern?: string|RegExp): string[]; + words( + string?: string, + pattern?: string|RegExp + ): string[]; } interface LoDashImplicitWrapper { @@ -9652,6 +9656,13 @@ declare module _ { words(pattern?: string|RegExp): string[]; } + interface LoDashExplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): LoDashExplicitArrayWrapper; + } + /*********** * Utility * ***********/