interface A { x: number; } interface A { y: number; } let InterA: A = { x: 1, y: 2, }; 在编辑器里程序会提示报错:Type '{ x: number; y: number; }' is missing the following properties from type 'A': id, name [2739] 不是定义多个接口A可合并吗?
对于视频中的问题: A namespace declaration cannot be located prior to a class or function with which it is merged. 对于它的理解,class 可以理解,导致重复声明变量名,语法会报错,对于 function, 则会把 namespace 整个声明覆写掉,对于枚举, 都是对象,不会有问题,最多把对象的属性覆写掉