*.d.ts 文件和 declare 关键字
tl;dr
‘declare’ is used to tell the compiler ‘this thing (usually a variable) exists already, and therefore can be referenced by other code, also there is no need to compile this statement into any JavaScript’.
一般用来声明缺少 ts 声明的三方库或一些资源变量。declaration:true意味着仅对于每个给定的.ts文件tsc都会生成相应的.d.ts输出文件并将其复制到build目录(除了.js和.map外,如果适用)。tsc不会将自定义的 types.d.ts文件复制到输出目录。
“scripts”: { “copy-dts”: “copyfiles -u 1 \”src/*/.d.ts\” build”}
关于 .ts 类声明的存放
公共的:
局部的:
index.ts:
其他形式:
