Injectable
Marks a class as an injectable provider for a token.
Dependencies are explicit and ordered by constructor parameter position. No
reflect-metadata, parameter decorators, or global container are used.
Example
Section titled “Example”@Injectable({ token: USER_SERVICE, deps: [LOGGER] })class UserService { private readonly logger: Logger;
constructor(logger: Logger) { this.logger = logger; }}Call Signature
Section titled “Call Signature”Injectable<
T,TDeps>(options):InjectableDecorator<InjectableConstructor<T,TDeps>>
Defined in: packages/di-craft/src/core/annotation/annotation.ts:47
Type Parameters
Section titled “Type Parameters”T
TDeps extends readonly Dependency<unknown>[]
Parameters
Section titled “Parameters”options
Section titled “options”InjectableOptions<T, TDeps> & object
Returns
Section titled “Returns”InjectableDecorator<InjectableConstructor<T, TDeps>>
Call Signature
Section titled “Call Signature”Injectable<
T>(options):InjectableDecorator<InjectableConstructor<T, readonly []>>
Defined in: packages/di-craft/src/core/annotation/annotation.ts:54
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”options
Section titled “options”InjectableOptionsWithoutDeps<T>
Returns
Section titled “Returns”InjectableDecorator<InjectableConstructor<T, readonly []>>