Skip to content

Interface: InjectableDescriptor<T, V>

Defined in: src/wirestate-core/types/provision.ts:42

Represents one container entry.

Remarks

Use descriptors when a class token is not enough: constants, factories, or a class behind a custom token.

Example

typescript
import { BindingType, InjectableDescriptor } from "@wirestate/core";

const API_URL = Symbol("API_URL");

const descriptor: InjectableDescriptor<string> = {
  id: API_URL,
  bindingType: BindingType.ConstantValue,
  value: "https://api.example.com",
};

Type Parameters

Type ParameterDefault typeDescription
TunknownResolved value type.
VunknownDescriptor value type.

Properties

bindingType?

ts
readonly optional bindingType?: BindingType;

Defined in: src/wirestate-core/types/provision.ts:46

Binding strategy.


factory?

ts
readonly optional factory?: () => T;

Defined in: src/wirestate-core/types/provision.ts:51

Factory used by dynamic value bindings.

Returns

T


id

ts
readonly id: ServiceIdentifier<T>;

Defined in: src/wirestate-core/types/provision.ts:56

Token used to resolve the entry.


scopeBindingType?

ts
readonly optional scopeBindingType?: ScopeBindingType;

Defined in: src/wirestate-core/types/provision.ts:61

Lifetime scope for created values.


value?

ts
readonly optional value?: V;

Defined in: src/wirestate-core/types/provision.ts:66

Fixed value or class constructor, depending on binding type.