From b54cbbe7e0c0523f5f2fcf896141403671e138bb Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 12 Aug 2015 03:29:17 +0500 Subject: [PATCH] lodash: changed _.noop() method --- lodash/lodash-tests.ts | 13 +++++++++++++ lodash/lodash.d.ts | 24 ++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d7d4b6f71..e315e90a4 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -89,6 +89,8 @@ class Dog { var result: any; +var any: any; + // _.MapCache var testMapCache: _.MapCache; result = <(key: string) => boolean>testMapCache.delete; @@ -1462,6 +1464,17 @@ result = _.random(5, true); result = _.random(1.2, 5.2); result = _.random(0, 5, true); +// _.noop +result = _.noop(); +result = _.noop(1); +result = _.noop('a', 1); +result = _.noop(true, 'a', 1); +result = _('a').noop(true, 'a', 1); +result = _([1]).noop(true, 'a', 1); +result = _([]).noop(true, 'a', 1); +result = _({}).noop(true, 'a', 1); +result = _(any).noop(true, 'a', 1); + var object = { 'cheese': 'crumpets', 'stuff': function () { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index acfa93dec..e9c585a62 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7299,6 +7299,22 @@ declare module _ { noConflict(): typeof _; } + //_.noop + interface LoDashStatic { + /** + * A no-operation function that returns undefined regardless of the arguments it receives. + * @return undefined + */ + noop(...args: any[]): void; + } + + interface LoDashWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): void; + } + //_.property interface LoDashStatic { /** @@ -7452,14 +7468,6 @@ declare module _ { uniqueId(prefix?: string): string; } - //_.noop - interface LoDashStatic { - /** - * A no-operation function. - **/ - noop(): void; - } - //_.constant interface LoDashStatic { /**