From 8c900f86c78582ce6ea8213249f42be1d06f381d Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 14 Sep 2015 07:25:24 +0500 Subject: [PATCH] lodash: changed _.runInContext() method --- lodash/lodash-tests.ts | 11 ++++++++--- lodash/lodash.d.ts | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index fc36241c5..a2ab359c8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1768,9 +1768,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: { @@ -2084,6 +2081,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 db2405580..7c2f61574 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8552,11 +8552,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