Extending the Function interface should not cause "instanceof" to fail. Adding new items shouldn't change the fact that it's still a Function instance type. (see http://goo.gl/mCb93P)
interface Function {
[index: string]: any;
}
class Base { }
class Greeter extends Base {
greeting: string;
constructor(message: string) {
super();
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
var greeter = new Greeter("world");
var button = document.createElement('button');
button.textContent = "Say Hello";
button.onclick = function () {
alert(greeter.greet());
}
document.body.appendChild(button);
var b: Base;
(b instanceof Greeter); <== 'Greeter' is an ERROR
The whole error message is "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."
The expected behaviour is that anything that is of type Function would inherit this same change, and thus should not cause errors.
Extending the Function interface should not cause "instanceof" to fail. Adding new items shouldn't change the fact that it's still a Function instance type. (see http://goo.gl/mCb93P)
The whole error message is "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."
The expected behaviour is that anything that is of type Function would inherit this same change, and thus should not cause errors.