Skip to main content

Factory TypeAlias

A function which takes in a lazy configuration and returns the content a component contributes.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Input

This type is "input," meaning that code outside of the library defining it should not read from it. Future versions of this type may add optional members or make typing of members more general.

Signature

type Factory<TComponent, TConfig = ComposedDefault<TComponent>> = (lazyConfiguration: () => TConfig) => TComponent;

Type Parameters

ParameterDefaultDescription
TComponentThe content a component contributes.
TConfigComposedDefault<TComponent>The composed configuration type made available to components. Defaults to the Composed produced by composition: the common case where components read composed content directly from the composition and no custom configuration type is needed.

Remarks

The lazy configuration allows the component to reference items from the composed configuration, which can include items the component itself contributes (allowing recursive references between components).

The execution of the factory must not evaluate lazyConfiguration (doing so will error): instead the returned TComponent can capture lazyConfiguration and evaluate it at a later time (after all components have been composed).