我有一个基本课程就像
class Animal {
}
我有两个孩子班
class Dog extends Animal {}
class Bird extends Animal {}
现在,我想定义一个包含Animal类的接口
interface Zoo{
name: string;
animal: Animal;
}
并使用它
const myZoo: Zoo = {
name: 'zooName',
animal: Dog // problem is here
}
说实话,我失败了。所以我该怎么做?谢谢。