UNPKG

1.34 kBTypeScriptView Raw
1import { BindingSpec } from './binding-inspector';
2import { Constructor } from './value-promise';
3/**
4 * Decorate a class with binding configuration
5 *
6 * @example
7 * ```ts
8 * @injectable((binding) => {binding.inScope(BindingScope.SINGLETON).tag('controller')}
9 * )
10 * @injectable({scope: BindingScope.SINGLETON})
11 * export class MyController {
12 * }
13 * ```
14 *
15 * @param specs - A list of binding scope/tags or template functions to
16 * configure the binding
17 */
18export declare function injectable(...specs: BindingSpec[]): ClassDecorator;
19/**
20 * A namespace to host shortcuts for `@injectable`
21 */
22export declare namespace injectable {
23 /**
24 * `@injectable.provider` to denote a provider class
25 *
26 * A list of binding scope/tags or template functions to configure the binding
27 */
28 function provider(...specs: BindingSpec[]): (target: Constructor<unknown>) => void;
29}
30/**
31 * `@bind` is now an alias to {@link injectable} for backward compatibility
32 * {@inheritDoc injectable}
33 */
34export declare function bind(...specs: BindingSpec[]): ClassDecorator;
35/**
36 * Alias namespace `bind` to `injectable` for backward compatibility
37 *
38 * It should have the same members as `bind`.
39 */
40export declare namespace bind {
41 /**
42 * {@inheritDoc injectable.provider}
43 */
44 const provider: typeof injectable.provider;
45}