Optional factoryArgs: ConstructorParameters<K>The arguments for the Targeted constructor.
Optional target: KAn optional Target constructor to override.
A class constructor decorator.
Target a service:
import { Target } from '@sgrud/core';
@Target(['default'])
export class Service {
public constructor(
public readonly param: string
) {}
}
Factor a Targeted service:
import { Factor, type Target } from '@sgrud/core';
import { Service } from './service';
export class ServiceHandler {
@Factor<Target<Service>>(() => Service)
public readonly service!: Service;
}
Generated using TypeDoc
Class decorator factory. Links the Targeted constructor to its corresponding instance by applying the supplied
factoryArgs. Employ this helper to link Targeted constructors with required arguments. Supplying atargetconstructor overrides its linked instance, if any, with the constructed instance.