From d5e01247c7210b898ebfc061de768e6f6e29d0bd Mon Sep 17 00:00:00 2001 From: Vsevolod Date: Wed, 15 May 2019 20:38:09 +0300 Subject: [PATCH] [@types/underscore] Add array as key for `property` (#34998) * [@types/underscore] Add array as key for `property` * [@types/underscore] Fix review issue --- types/underscore/index.d.ts | 4 ++-- types/underscore/underscore-tests.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index 504a6a52ee..d38cab453d 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -3812,14 +3812,14 @@ declare module _ { * @param key Property of the object. * @return Function which accept an object an returns the value of key in that object. **/ - property(key: string): (object: Object) => any; + property(key: string | string[]): (object: Object) => any; /** * Returns a function that will itself return the value of a object key property. * @param key The object to get the property value from. * @return Function which accept a key property in `object` and returns its value. **/ - propertyOf(object: Object): (key: string) => any; + propertyOf(object: Object): (key: string | string[]) => any; /** * Performs an optimized deep comparison between the two objects, diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 1a32063ef5..2f24c650be 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -387,6 +387,7 @@ _.isObject({}); _.isObject(1); _.property('name')(moe); +_.property(['name'])(moe); // (() => { return _.isArguments(arguments); })(1, 2, 3);