其他分享
首页 > 其他分享> > [TypeScript] Type Definitions and Modules

[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.

标签:TypeScript,Lodash,FirstFunction,Modules,module,own,export,Definitions,declare
来源: https://www.cnblogs.com/Answer1215/p/10353435.html