0
界面中是否可以使用類似類型的類?例如,我有一個類動物,我可以使用類似:TypeScript的界面中的類型
interface I {
object: Animal
}
我有恩的錯誤在這種情況下:
class A {
public static foo(text: string): string {
return text;
}
}
interface IA {
testProp: A;
otherProp: any;
}
class B {
constructor(prop: IA) {
console.log(prop.otherProp);
console.log(prop.testProp.foo('hello!'));
}
}
TS2339:房產「富」是不存在的'A' 型
謝謝,這個作品 –