diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index db0328cc2..d8be1f68a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2439,6 +2439,23 @@ result = <() => {}>_({}).constant<{}>(); result = _({}).iteratee(any).value(); } +// _.matches +module TestMatches { + let source: TResult; + + { + let result: (value: any) => boolean; + result = _.matches(source); + result = _(source).matches().value(); + } + + { + let result: (value: TResult) => boolean; + result = _.matches(source); + result = _(source).matches().value(); + } +} + // _.method class TestMethod { a = { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index bd44e7953..1d500be9c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8423,6 +8423,38 @@ declare module _ { iteratee(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>; } + //_.matches + interface LoDashStatic { + /** + * Creates a function that performs a deep comparison between a given object and source, returning true if the + * given object has equivalent property values, else false. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own + * or inherited property value see _.matchesProperty. + * + * @param source The object of property values to match. + * @return Returns the new function. + */ + matches( + source: T + ): (value: any) => boolean; + + /** + * @see _.matches + */ + matches( + source: T + ): (value: V) => boolean; + } + + interface LoDashWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashObjectWrapper<(value: V) => boolean>; + } + //_.method interface LoDashStatic { /**