在常见的项目中,对于一些常用的全局声明,最好在项目根目录中建一个types文件夹,然后里面根据模块去定义类型
最关键的是在tsconfig.json中配置types下的文件自动导入

{
 "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue", "types/*"]
}

tsconfig说明文档地址:https://www.tslang.cn/docs/handbook/tsconfig-json.html

Last modification:August 12, 2021
If you think my article is useful to you, please feel free to appreciate