Skip to content

Interface: UseInjectionOptions<T, F>

Defined in: src/wirestate-lit/consumption/use-injection.ts:26

Describes options for useInjection.

Type Parameters

Type ParameterDefault type
T-
Fundefined

Properties

fallback?

ts
readonly optional fallback?: InjectionFallback<F>;

Defined in: src/wirestate-lit/consumption/use-injection.ts:51

Value used when the token is not bound. Providing it makes the lookup optional.

Remarks

A function fallback is treated as a factory and receives the active container.


optional?

ts
readonly optional optional?: boolean;

Defined in: src/wirestate-lit/consumption/use-injection.ts:43

Resolve undefined instead of throwing when the token is not bound.


token

ts
readonly token: ServiceToken<T>;

Defined in: src/wirestate-lit/consumption/use-injection.ts:30

The token to inject.


value?

ts
readonly optional value?: Nullable<T | F>;

Defined in: src/wirestate-lit/consumption/use-injection.ts:38

Initial value held until the context resolves.

Remarks

Useful when templates may read the holder before the first context callback runs.