【发布时间】:2016-01-18 08:50:48
【问题描述】:
我试过这个,但它不起作用。 Foo 只是对有效方法的测试。 Bar 是真正的尝试,它应该接收任何新的类型,但 Object 的子类对此无效。
class A {
}
class B {
public Foo(newable: typeof A):void {
}
public Bar(newable: typeof Object):void {
}
}
var b = new B();
b.Foo(A);
b.Bar(A); // <- error here
【问题讨论】:
标签: typescript method-signature newable