- 放置位置
- tsconfig.json配置
- 声明方式
// index.d.ts
declare interface IEditCardListItem { .... }
可以将type/interface的定义放到src/type下,需要将文件名称设置成xxx.d.ts、tsconfig.json中需要在include中将src/**/*.d.ts设置上这样就可以在其他地方直接使用而不需要import来进行对应的导入。
【总结】
tsconfig.json中include中需要将interface或则type定义的文件包含- 定义类型的文件名称后缀是
.d.ts - .d.ts文件中需要使用
decalre来声明interface和type
【链接】
- ts中的.d.ts和declare究竟是干什么的:链接