Documents injecute 1.x · Migrating from 0.x
Skip to content

Interface: SingletonOptions<D, T> ​

Defined in: src/types.ts:165

Options for ServiceRegistry.addSingleton.

Extends ​

Type Parameters ​

D ​

D

T ​

T

Properties ​

dependencies? ​

optional dependencies?: D

Defined in: src/types.ts:148

Dependency keys, passed to the factory in the same order.

Inherited from ​

RegistrationOptions.dependencies


dispose? ​

optional dispose?: DisposeOption<T>

Defined in: src/types.ts:167

How dispose() releases the instance. Default: auto-detect [Symbol.asyncDispose] / [Symbol.dispose].


replace? ​

optional replace?: boolean

Defined in: src/types.ts:161

Replace an existing registration of this key: one in the same container, or a parent's one in a fork (required there too). With replace: true the service's type becomes the new one (see Registered).

In a plain fork the replacement applies to services resolved in the fork: services registered in a parent keep the parent's instance. In an isolated fork it applies to every service resolved through the fork.

There must be something to replace: replace: true for a key that no container has throws INJECUTE_NOTHING_TO_REPLACE.

Inherited from ​

RegistrationOptions.replace

Released under the MIT License.