Skip to content

Releases: eggjs/egg-ts-helper

1.16.1

29 Nov 07:36
Compare
Choose a tag to compare
  • fix: add tslib deps

1.16.0

29 Nov 07:31
Compare
Choose a tag to compare
  • chore: update comment
  • feat: add prefix to interface
  • refactor: add esModuleInterop option
  • feat: add new generator function and object
  • refactor: refactor build-in generators
// ./tshelper.js

module.exports = {
  watchDirs: {
    model: {
      path: 'app/model', // dir path
      generator: 'class', // generator name
      interface: 'IModel',  // interface name
      declareTo: 'Context.model', // declare to this interface
    }
  }
}

generator set to class.

interface IModel {
  Station: Station;
}

generator set to function.

interface IModel {
  Station: ReturnType<typeof Station>;
}

generator set to object.

interface IModel {
  Station: typeof Station;
}

1.15.0

29 Nov 07:34
Compare
Choose a tag to compare
  • feat: add declareTo option
  • chore: upgrade typescript to 3.0
// ./tshelper.js

module.exports = {
  watchDirs: {
    model: {
      path: 'app/model', // dir path
      generator: 'class', // generator name
      interface: 'IModel',  // interface name
      declareTo: 'Context.model', // declare to this interface
    }
  }
}

declareTo set to Context.model

import Station from '../../../app/model/station';

declare module 'egg' {
  interface Context {
    model: IModel;
  }

  interface IModel {
    Station: Station;
  }
}

declareTo set to Application.model.subModel

import Station from '../../../app/model/station';

declare module 'egg' {
  interface Application {
    model: {
      subModel: IModel;
    }
  }

  interface IModel {
    Station: Station;
  }
}

1.7.0

07 May 06:18
Compare
Choose a tag to compare

Support auto create d.ts for middleware

  • fix: lint fix
  • feat: support auto created d.ts for middleware

The middleware

// app/middlware/uuid.ts

export default function() {
  return async (context, next) => {
    await next();
  };
}

The d.ts created by ets

// typings/middleware/index.d.ts

import Uuid from '../../../app/middleware/uuid';

declare module 'larva' {
  interface IMiddleware {
    uuid: ReturnType<typeof Uuid>;
  }
}

1.6.2

07 May 06:23
Compare
Choose a tag to compare
Release 1.6.2

1.6.1

07 May 06:24
Compare
Choose a tag to compare

1.6.1 / 2018-04-23

  • fix: make sure register was running only once time

1.6.0

07 May 06:24
Compare
Choose a tag to compare

1.6.0 / 2018-04-10

  • feat: do not write file if ts not changed
  • feat: add plugin generator