diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 877364ef0..6501b7f48 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -893,9 +893,22 @@ result = result(1, true); result = _((x: string, y: string) => [x, y]).modArgs([modArgsFn1, modArgsFn2]).value(); result = result(1, true); +// _.negate +interface TestNegatePredicate { + (a1: number, a2: number): boolean; +} +interface TestNegateResult { + (a1: number, a2: number): boolean; +} +var testNegatePredicate = (a1: number, a2: number) => a1 > a2; +result = _.negate(testNegatePredicate); +result = _.negate(testNegatePredicate); +result = _(testNegatePredicate).negate().value(); +result = _(testNegatePredicate).negate().value(); + var initialize = _.once(function () { }); initialize(); -initialize();'' +initialize(); var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5); returnedOnce(4); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 7bbb65a54..fa9309820 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5474,6 +5474,34 @@ declare module _ { modArgs(transforms: Function[]): LoDashObjectWrapper; } + //_.negate + interface LoDashStatic { + /** + * Creates a function that negates the result of the predicate func. The func predicate is invoked with + * the this binding and arguments of the created function. + * @param predicate The predicate to negate. + * @return Returns the new function. + */ + negate(predicate: T): (...args: any[]) => boolean; + + /** + * @see _.negate + */ + negate(predicate: T): TResult; + } + + interface LoDashObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashObjectWrapper; + } + //_.once interface LoDashStatic { /**