diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index e67f9827d..877364ef0 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1373,6 +1373,18 @@ result = _.words('fred, barney, & pebbles', /[^, ]+/g); * Utilities * ***********/ +// _.constant +result = <() => number>_.constant(1); +result = <() => string>_.constant('a'); +result = <() => boolean>_.constant(true); +result = <() => any[]>_.constant([]); +result = <() => {}>_.constant<{}>({}); +result = <() => number>_(1).constant(); +result = <() => string>_('a').constant(); +result = <() => boolean>_(true).constant(); +result = <() => any[]>_(['a']).constant(); +result = <() => {}>_({}).constant<{}>(); + result = _.VERSION; result = <_.Support>_.support; result = <_.TemplateSettings>_.templateSettings; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 0b3aaf389..7bbb65a54 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -6990,11 +6990,20 @@ declare module _ { //_.constant interface LoDashStatic { /** - * Creates a function that returns value.. - **/ + * Creates a function that returns value. + * @param value The value to return from the new function. + * @return Returns the new function. + */ constant(value: T): () => T; } + interface LoDashWrapperBase { + /** + * @see _.constant + */ + constant(): () => TResult; + } + //_.create interface LoDashStatic { /**