Extend interface defined in .d.ts file
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my TypeScript project, I use DefinitelyTyped definitions for external js dependencies. Sometimes it might happen that these definitions are outdated. It might also happen than some libraries can add new methods at runtime, like express-validator in which you can define custom validator functions. Therefore I would like to extend those .d.ts definitions adding new methods and/or properties. So if I have my DefinitelyTyped defininiton in express-validator.d.ts : declare module ExpressValidator { export interface Validator { is(): Validator;