ho esteso il prototipo di funzione ma il dattiloscritto non lo riconosce.Come si estende il prototipo al dattiloscritto?
Function.prototype.proc = function() {
var args, target, v;
var __slice = [].slice;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
target = this;
while (v = args.shift()) {
target = target(v);
}
return target;
};
// generated by coffee-script
var foo: (number) => (string) => number
= (a) => (b) => a * b.length;
console.log(foo.proc("first", "second"))
risultato: TSC -e
The property 'proc' does not exist on value of type 'Function'
Come posso estendere questo oggetto?
thx !, funziona! – mizchi
considera di contrassegnarlo come risposta. –
Come fare questo con le tue classi? –