@dawnjs/types

    2.0.1 • Public • Published

    @dawnjs/types

    安装依赖

    $ npm install --save-dev @dawnjs/types

    使用方式

    // 中间件的 TS 入口文件
    // src/index.ts
    
    import * as Dawn from "@dawnjs/types";
    
    interface IOptions {
      name?: string;
      age?: number;
    }
    
    const handler: Dawn.Handler<IOptions> = opts => {
      return async (next, ctx) => {
        ctx.console.log(`My name is ${opts.name}`);
        ctx.console.log(ctx.utils.isFunction(ctx.load));
        await next();
      };
    };
    
    export default handler;

    Keywords

    none

    Install

    npm i @dawnjs/types

    Homepage

    dawnjs.com

    DownloadsWeekly Downloads

    2

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    36.1 kB

    Total Files

    15

    Last publish

    Collaborators

    • djknight
    • jeason
    • soulwu
    • ssbabysong