diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7927a04ed..bc580e7a8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1887,9 +1887,6 @@ result = _([]).noop(true, 'a', 1); result = _({}).noop(true, 'a', 1); result = _(any).noop(true, 'a', 1); -var tempObject = {}; -result = _.runInContext(tempObject); - // _.property interface TestPropertyObject { a: { @@ -2203,6 +2200,14 @@ result = (_(TestMethodOfObject).methodOf(1, 2).value())(['a', '0 result = _({}).noConflict(); } +// _.runInContext +{ + let result: typeof _; + result = _.runInContext(); + result = _.runInContext({}); + result = _({}).runInContext(); +} + // _.uniqueId result = _.uniqueId(); result = _.uniqueId(''); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 7e879b16b..e607a8f4e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8568,11 +8568,19 @@ declare module _ { //_.runInContext interface LoDashStatic { /** - * Create a new lodash function using the given context object. - * @param context The context object - * @returns The lodash function. - **/ - runInContext(context: any): typeof _; + * Create a new pristine lodash function using the given context object. + * + * @param context The context object. + * @return Returns a new lodash function. + */ + runInContext(context?: Object): typeof _; + } + + interface LoDashObjectWrapper { + /** + * @see _.runInContext + */ + runInContext(): typeof _; } //_.times