Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
egg-ts-helper
Advanced tools
A simple tool for generating declaration files in egg application. Injecting controller
,proxy
,service
and extend
to egg by Declaration Merging
npm i egg-ts-helper -g
or
yarn global add egg-ts-helper
$ ets -h
Usage: ets [options]
Options:
-h, --help usage
-v, --version show version
-w, --watch watch file change
-c, --cwd [path] egg application base dir(default: process.cwd)
-f, --framework [name] egg framework(default: egg)
-s, --silent no log
-i, --ignore ignore dir, your can ignore multiple dirs with comma like: -i proxy,controller
see https://github.com/whxaxes/egg-boilerplate-d-ts
It works in these directories : app/controller
, app/service
, app/proxy
, app/extend
.
(service, proxy are the same)
ts
// app/controller/home.ts
import { Controller } from 'egg';
export default class HomeController extends Controller {
public async index() {
this.ctx.body = 'ok';
}
}
typings
// app/typings/app/controller/index.d.ts
import Home from '../../../app/controller/home';
declare module 'egg' {
interface IController {
home: Home;
}
}
ts
// app/extend/context.ts
export default {
doSomething() {
console.info('do something');
}
};
typings
// app/typings/app/controller/index.d.ts
import ExtendObject from '../../../app/extend/context';
declare module 'egg' {
interface Context {
doSomething: typeof ExtendObject.doSomething;
}
}
FAQs
egg typescript helper
The npm package egg-ts-helper receives a total of 15,911 weekly downloads. As such, egg-ts-helper popularity was classified as popular.
We found that egg-ts-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.