2
如何鍵入提示類而不是類的實例?如何鍵入提示類而不是類的實例?
我嘗試這樣做,但我得到Cannot use 'new' with an expression whose type lacks a call or construct signature.
class Foo {
}
class Bar extends Foo {
}
class Baz extends Foo {
}
function test(c: Foo) {
new c();
}
test(Baz);