Setu-TS
    Preparing search index...

    Function resolveRegistryEntry

    • Resolves one entry of a registration option that accepts either an instance or a RegistryFactory.

      A non-function entry is returned unchanged — the instance arm is byte-identical to the pre-factory behaviour. A function entry is called once with services, and its return value is the result. A throw from the factory is wrapped in an Error whose message names label and whose cause is the original, so a factory that resolves a capability the application forgot to register fails start() naming the option and the entry rather than escaping with a bare registry message.

      The discrimination is typeof entry === 'function': no instance of any registration contract is callable, and a class — the one shape that is a function and not a factory — is not assignable to RegistryFactory<T>, so passing one is a compile error rather than a runtime TypeError.

      Type Parameters

      • T

        The instance type the option accepts

      Parameters

      • entry: T | RegistryFactory<T>

        An instance or a factory producing one

      • services: IServiceRegistry

        The registry handed to a factory

      • label: string

        A human-readable name of the option and entry, for error attribution

      Returns T

      The resolved instance

      If a factory entry throws; the message names label and the cause is the original error

      0.1.0