[TypeScript] Type Definitions and Modules

For example you are building your own module, the same as Lodash:

my-lodash.d.ts

复制代码
declare module "lodash" {
    declare interface FirstFunction {
        (data: any[]) :any;
    }

    declare interface Lodash {

         first: FirstFunction;
    }

    export const _: Lodash:
}
复制代码

 

Normally you can install @types for popluar 3rd-party libs, if you have to build your own, you need to remember export type defination aas well for Typescript.

posted @   Zhentiw  阅读(303)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示