borisyankov/DefinitelyTyped — pull request #1712 by jraymakers (2014-02-19 17:32:29+00:00)
Title: underscore: remove 'extends {}' constraint from each and map

The "each" (and "forEach") and "map" (and "collect") function definitions in underscore.d.ts have overloads to cover the case where these functions can take an object as the first parameter instead of a list. These overloads all use the type parameter constraint "extends {}". However, this type parameter constraint - that the property values of the given object must be a subtype of object - is incorrect. The constraint is that the first parameter must be an object with property values of the same type (but that type need not be a subtype of object). This constraint is already captured by declaring the first parameter to be of type _.Dictionary. It is unnecessarily constraining to also require T to be a subtype of object. In cases where T is not an object, this extra constraint causes type errors even though the call to underscore works just fine.