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

TypeScript interface 和type的区别

 

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

TypeScript interface 和type的区别

 

相关文章:

  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2021-07-27
猜你喜欢
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
相关资源
相似解决方案