diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index 72498e3591..1b89408ab3 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -69,6 +69,10 @@ declare module _ { [index: string]: T; } + interface Predicate { + (value: T): boolean; + } + interface ListIterator { (value: T, index: number, list: List): TResult; } @@ -3782,7 +3786,7 @@ declare module _ { * @param attrs Object with key values pair * @return Predicate function **/ - matches(attrs: T): _.ListIterator; + matches(attrs: T): _.Predicate; /** * Returns a predicate function that will tell you if a passed in object contains all of the key/value properties present in attrs. @@ -3790,7 +3794,7 @@ declare module _ { * @param attrs Object with key values pair * @return Predicate function **/ - matcher(attrs: T): _.ListIterator; + matcher(attrs: T): _.Predicate; /** * Returns a function that will itself return the key property of any passed-in object. diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 6175c1874b..13bc542b28 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -216,6 +216,8 @@ interface Family { } var isUncleMoe = _.matches({ name: 'moe', relation: 'uncle' }); _.filter([{ name: 'larry', relation: 'father' }, { name: 'moe', relation: 'uncle' }], isUncleMoe); +var uncleMoe: Family = { name: 'moe', relation: 'uncle' }; +isUncleMoe(uncleMoe);