Interface Builder<P>

A Container-like object used for providing values for a Module.

Type Parameters

Hierarchy

  • Builder

Methods

  • Adds the given Scopes to this container. Any dependencies with this scope will be instantiated when first requested and memoized within this container.

    Type Parameters

    Parameters

    • Rest ...scope: S[]

      The scope or scopes to add to this container

    Returns Builder<Provide<P, S extends any
        ? DepPair<S, never>
        : never>>

    This container, now typed to include the added scopes

  • Applies the given Modules or Items to this container. All scopes and dependencies provided with the modules will be applied to this container.

    Type Parameters

    Parameters

    • Rest ...modules: M

      The modules to apply to the container.

    Returns Builder<Merge<P, Provides<M>>>

    This container, now typed to include all types provided within the given modules

    See

    apply

  • Binds the resolved value of src to key. In other words, when key is requested, src will be used to provide the value. Equivalent to provide(key, Inject.from(src))

    Type Parameters

    • K extends ResourceKey

    • Src extends any

    Parameters

    • key: K

      The key or class of the type to be provided

    • src: Src

      The DependencyKey to use to when key is requested

    Returns Builder<Provide<P, DepPair<ToBaseResource<K>, DepsOf<Src>> | DepPair<IsSync<ToBaseResource<K>>, IsSyncDepsOf<Src>>>>

    This container, now typed to include the provided type and its dependencies

    See

    bind

  • Specifies how to resolve the target type of the given key or class.

    Type Parameters

    • K extends ResourceKey

      The type of the key or class object

    • SrcK extends DependencyKey = never

      Identifies the source data for the provider

    • D = DepsOf<SrcK>

      Identifies the dependencies of the provided type

    • Sync = RequireSync<D>

      Identifies the dependencies for the type to be resolved synchronously

    • S extends Scope = never

    Parameters

    • key: K

      The key or class of the type to be provided

    • Rest ...args: [init: ComputedKey<Target<K>, any, D, Sync, P>] | [deps: SrcK, init: ((deps) => Target<K>)] | [init: (() => Target<K>)] | [scope: NonEmptyScopeList<S>, init: ComputedKey<Target<K>, any, D, Sync, P>] | [scope: NonEmptyScopeList<S>, deps: SrcK, init: ((deps) => Target<K>)] | [scope: NonEmptyScopeList<S>, init: (() => Target<K>)]

      The remaining arguments. These include:

      • scope (optional): The Scope or ScopeList to which to bind the provided value And one of the following:
      • init: A function returning the provided value, or a ComputedKey yielding the provided value
      • deps, init:
        • deps: An object specifying which dependencies are required to provide the value
        • init: A function that accepts the dependencies specified by deps and returns the provided value

    Returns Builder<Provide<P, PairForProvide<K, D, S> | PairForProvideIsSync<K, Sync, S>>>

    This container, now typed to include the provided type and its dependencies

    See

    provide

  • Specifies how to asynchronously resolve the target type of the given key or class. The signature is the same as provide, except that a Promise to the target type can be provided. The provided type cannot be directly requested through request. It can, however be requested through requestAsync or by using key.Async().

    Type Parameters

    • T

    • K extends ResourceKey<Awaited<T>>

      The type of the key or class object

    • SrcK extends DependencyKey = never

      Identifies the source data for the provider

    • D = DepsOf<SrcK>

      Identifies the dependencies of the provided type

    • S extends Scope = never

    Parameters

    • key: K

      The key or class of the type to be provided

    • Rest ...args: [init: ComputedKey<T, any, D, any, P>] | [deps: SrcK, init: ((deps) => T)] | [init: (() => T)] | [scope: NonEmptyScopeList<S>, init: ComputedKey<T, any, D, any, P>] | [scope: NonEmptyScopeList<S>, deps: SrcK, init: ((deps) => T)] | [scope: NonEmptyScopeList<S>, init: (() => T)]

      The remaining arguments. These include:

      • scope (optional): The Scope or ScopeList to which to bind the provided value And one of the following:
      • init: An async function returning the provided value, or a ComputedKey yielding the provided value or a promise
      • deps, init:
        • deps: An object specifying which dependencies are required to provide the value
        • init: An async function that accepts the dependencies specified by deps and returns the provided value

    Returns Builder<Provide<P, PairForProvide<K, D, S> | PairForProvideNotSync<K>>>

    This container, now typed to include the provided type and its dependencies

  • Provides an instance of the target type for the given key or class.

    Type Parameters

    • K extends ResourceKey

      The type of the key or class object

    Parameters

    • key: K

      The key or class of the type to be provided

    • instance: Target<K>

      The provided instance

    Returns Builder<Provide<P, DepPair<IsSync<ToBaseResource<K>>, never> | DepPair<ToBaseResource<K>, never>>>

    This container, now typed to include the provided type and its dependencies

Generated using TypeDoc