Typescript: Object of T but value is Predicate -


for following function (see http://ramdajs.com/docs/#where)

var spec2 = {x: function(val, obj) { return  val + obj.y > 10; }}; r.where(spec2, {x: 2, y: 7}); //=> false r.where(spec2, {x: 3, y: 8}); //=> true 

i create typing case object t has value of predicate.

i thinking this:

    where<t>(spec: {item: (val: any, testobj: t) => boolean}, testobj: t): boolean; 

but i'm not sure key.

there isn't way represent in typescript type system.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -