Options
All
  • Public
  • Public/Protected
  • All
Menu

@mgdigital/tsinject - v0.3.1

Index

Type aliases

ContainerKey

ContainerKey: symbol | string

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

Decorator

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

Type parameters

Type declaration

Factory

Factory<T, TServiceMap>: (container: Container<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 containerKeyValues

  • Get all property values T[] from any object that is a Record<ContainerKey, T>

    Type parameters

    • T = unknown

      The type of the property values.

    Parameters

    • obj: Record<ContainerKey, T>

      The object to extract the values from.

    Returns T[]

    The extracted values.

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