interface可以扩展,type不可扩展。interface和别的声明合并以后就可能不符合所有字段都是string或者number的约束

TypeScript interface 和type的区别

 

 改成type,因为type无法扩展,所以没问题

TypeScript interface 和type的区别

 

相关文章: