【发布时间】:2022-08-11 04:34:11
【问题描述】:
使用 Typescript 类装饰器时遇到问题,但为简单起见,我的示例不会包含它们
class AClass {
handle() {
console.log(\"Handled\")
}
}
function callHandler(constructor: Type) {
return new constructor().handle()
}
callHandler(AClass)
我尝试用Function 替换Type,但我得到:
file:ln:rw - error TS2351: This expression is not constructable.
Type \'Function\' has no construct signatures.
ln new constructor().handle()
~~~~~~~~~~~~~~~
除了any,还有什么我可以使用的类型被认为是可构造的?
标签: node.js typescript class