UNPKG

@adonisjs/fold

Version:

Simplest and straightforward implementation of IoC container in JavaScript

28 lines (27 loc) 632 B
/** * The "@inject" decorator uses Reflection to inspect the dependencies of a class * or a method and defines them as metadata on the class for the container to * discover them. * * @example * ```ts * @inject() * class UsersController { * constructor(private database: Database) {} * } * ``` * * @example * ```ts * class UsersController { * @inject() * async index(request: Request, response: Response) { * // Method with dependency injection * } * } * ``` */ export declare function inject(): { <C extends Function>(target: C): void; (target: any, propertyKey: string | symbol): void; };