覆盖一个npm包的默认typescript类型定义 🔑 How to override or extend a libary type definition in Typescript

比如给axios的 AxiosRequestConfig 加一个属性:

创建一个 src/axios.d.ts 文件,内容为:

 

 

 

Put additional typings in custom-typings.d.ts in root of src.

custom-typings.d.ts

 

my-module.ts

 

Why import with ES5 syntax (require)? ES6 modules and their properties are constant.

 

 

from: https://stackoverflow.com/questions/43952198/how-to-override-or-extend-a-libary-type-definition-in-typescript

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注