为什么下面代码没有问题?
interface Animal {
name:string;
}
interface Cat extends Animal{
scratch:Function;
bark:Function;
}
interface ShortHair extends Cat{}
class ShortHair implements Cat{}
shortHair类并没有实现接口的属性和方法,但是因为interface和class同名,导致没有报错,这是为什么?
同名
interface
会自动聚合,也可以和已有的同名class
聚合,适合做polyfil