Function: forwardRef()
ts
function forwardRef<TInstance>(forward: () => ServiceIdentifier<TInstance>): LazyServiceIdentifier<TInstance>;Defined in: src/wirestate-core/alias.ts:95
Wraps a token for circular constructor dependencies.
forwardRef delays token lookup. It is a small escape hatch, not a design goal. If two services need each other like two drawers that cannot open together, prefer moving the shared piece into a third service.
Type Parameters
| Type Parameter | Default type |
|---|---|
TInstance | unknown |
Parameters
| Parameter | Type | Description |
|---|---|---|
forward | () => ServiceIdentifier<TInstance> | Function that returns the token. |
Returns
LazyServiceIdentifier<TInstance>
Lazy service identifier.