Factory
Callable
Type parameters
- T
Parameters
type: string | Constructable<T>
The type of class that the factory creates.
optionaloptions: { metadata?: {} }
Allows registering multiple factories for the same class that differ by metadata.
Returns (constructor: { create: (...args: unknown[]) => Promise<T> }) => void
The decorated class.
Parameters
constructor: { create: (...args: unknown[]) => Promise<T> }
Returns void
A
@Factory
is a class decorator to be placed on top of a class that represents a factory. A factory is responsible for creating instances of a class.It is possible to generate multiple factories for the same class by assigning a unique set of metadata to the factory. Of all registered factories, only one can be the default factory.