UNPKG

1.79 kBTypeScriptView Raw
1import { ScopeOptions } from '../../interfaces/scope-options.interface';
2import { Type } from '../../interfaces/type.interface';
3/**
4 * Defines the injection scope.
5 *
6 * @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
7 *
8 * @publicApi
9 */
10export type InjectableOptions = ScopeOptions;
11/**
12 * Decorator that marks a class as a [provider](https://docs.nestjs.com/providers).
13 * Providers can be injected into other classes via constructor parameter injection
14 * using Nest's built-in [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection)
15 * system.
16 *
17 * When injecting a provider, it must be visible within the module scope (loosely
18 * speaking, the containing module) of the class it is being injected into. This
19 * can be done by:
20 *
21 * - defining the provider in the same module scope
22 * - exporting the provider from one module scope and importing that module into the
23 * module scope of the class being injected into
24 * - exporting the provider from a module that is marked as global using the
25 * `@Global()` decorator
26 *
27 * Providers can also be defined in a more explicit and imperative form using
28 * various [custom provider](https://docs.nestjs.com/fundamentals/custom-providers) techniques that expose
29 * more capabilities of the DI system.
30 *
31 * @param options options specifying scope of injectable
32 *
33 * @see [Providers](https://docs.nestjs.com/providers)
34 * @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
35 * @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
36 *
37 * @publicApi
38 */
39export declare function Injectable(options?: InjectableOptions): ClassDecorator;
40/**
41 * @publicApi
42 */
43export declare function mixin<T>(mixinClass: Type<T>): Type<T>;