【发布时间】:2020-07-26 06:34:36
【问题描述】:
试图将一个组件导入到第二个组件我收到以下错误。
“InputComponent”类型中缺少属性“原型”,但这是必需的 在类型'typeof InputComponent'中。 TS(2741)
test.ts
class InputComponent {
add():number{
return 1 + 1
}
}
class Example {
public input: typeof InputComponent;
constructor(Input: typeof InputComponent) {
this.input = new Input();
}
}
class Example2 {
public input: typeof InputComponent;
constructor(Input: typeof InputComponent = InputComponent) {
this.input = new Input();
}
}
这是错误和沙箱的屏幕截图。
【问题讨论】:
标签: typescript