lodash: signatures of _.negate have been changed

This commit is contained in:
Ilya Mochalov
2015-12-06 14:43:21 +05:00
parent e5a27ea95e
commit 8d8abe471b
2 changed files with 44 additions and 10 deletions
+31 -10
View File
@@ -4925,17 +4925,38 @@ module TestModArgs {
}
// _.negate
interface TestNegatePredicate {
(a1: number, a2: number): boolean;
module TestNegate {
interface PredicateFn {
(a1: number, a2: number): boolean;
}
interface ResultFn {
(a1: number, a2: number): boolean;
}
var predicate = (a1: number, a2: number) => a1 > a2;
{
let result: ResultFn;
result = _.negate<PredicateFn>(predicate);
result = _.negate<PredicateFn, ResultFn>(predicate);
}
{
let result: _.LoDashImplicitObjectWrapper<ResultFn>;
result = _(predicate).negate();
result = _(predicate).negate<ResultFn>();
}
{
let result: _.LoDashExplicitObjectWrapper<ResultFn>;
result = _(predicate).chain().negate();
result = _(predicate).chain().negate<ResultFn>();
}
}
interface TestNegateResult {
(a1: number, a2: number): boolean;
}
var testNegatePredicate = (a1: number, a2: number) => a1 > a2;
result = <TestNegateResult>_.negate<TestNegatePredicate>(testNegatePredicate);
result = <TestNegateResult>_.negate<TestNegatePredicate, TestNegateResult>(testNegatePredicate);
result = <TestNegateResult>_(testNegatePredicate).negate().value();
result = <TestNegateResult>_(testNegatePredicate).negate<TestNegateResult>().value();
// _.once
module TestOnce {
+13
View File
@@ -8462,6 +8462,7 @@ declare module _ {
/**
* 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.
*/
@@ -8485,6 +8486,18 @@ declare module _ {
negate<TResult extends Function>(): LoDashImplicitObjectWrapper<TResult>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.negate
*/
negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>;
/**
* @see _.negate
*/
negate<TResult extends Function>(): LoDashExplicitObjectWrapper<TResult>;
}
//_.once
interface LoDashStatic {
/**