Options
All
  • Public
  • Public/Protected
  • All
Menu

@mgdigital/tsinject - v0.1.15

Index

Type aliases

ContainerKey

ContainerKey: symbol | string

Container keys can be symbols or strings. Using unique symbols is recommended.

ContainerModule

ContainerModule<TProvidedServices, TRequiredServices>: (builder: IContainerBuilder<TRequiredServices>) => IContainerBuilder<TRequiredServices & TProvidedServices>

Type parameters

Type declaration

    • A container module encapsulates one or more calls to an IContainerBuilder as a reusable component.

      Parameters

      • builder: IContainerBuilder<TRequiredServices>

        A [[ContainerBuilder]] instance with the required services defined.

      Returns IContainerBuilder<TRequiredServices & TProvidedServices>

      A [[ContainerBuilder]] instance with the provided services defined.

Decorator

Decorator<TServiceMap, TKey>: (factory: Factory<ServiceTypeOf<TServiceMap, TKey>, TServiceMap>) => Factory<ServiceTypeOf<TServiceMap, TKey>, TServiceMap>

Type parameters

Type declaration

Factory

Factory<T, TServiceMap>: (container: IContainer<TServiceMap>) => T

Type parameters

Type declaration

    • A function that can create a service using a container of its dependencies.

      Parameters

      Returns T

FactoryMap

FactoryMap<TServiceMap>: { [ key in keyof TServiceMap]: Factory<ServiceTypeOf<TServiceMap, key>, TServiceMap> }

A map of container keys to factory functions (used internally).

internal

Type parameters

ServiceMap

ServiceMap<TKey, T>: { [ key in TKey]: T }

A map of container keys to the type of the service they represent.

Type parameters

ServiceTypeOf

ServiceTypeOf<TServices, TKey>: TServices[TKey] extends infer T ? T : never

Get the type of a service from a ServiceMap, using its key.

Type parameters

  • TServices: ServiceMap

    The service map.

  • TKey: keyof TServices

    The service key.

Functions

Const containerKeys

  • containerKeys<TKey>(obj: Record<TKey, unknown>): TKey[]
  • Get all the container keys from any object that is a Record<ContainerKey, unknown>

    Type parameters

    Parameters

    • obj: Record<TKey, unknown>

      The object to extract the keys from.

    Returns TKey[]

    The extracted keys.

Const newContainerBuilder

Generated using TypeDoc