TypeScript配置.d.ts本页总览.d.ts当我们在TS文件中需要引入外部库时,编译时是无法判断传入参数的类型的,所以我们需要在引入前加入一个声明文件来帮助ts判断类型。 当然现在大部分库都自带有自己的声明文件,一般在@types目录下。 声明语法 声明全局变量 通过declare let/const声明全局变量 声明全局方法 通过declare function声明全局方法 声明全局类