Hi, it seems like we don't support exporting a generic Spec type, currently Spec looks like this:
interface Spec {
/** Root element key */
root: string;
/** Flat map of elements by key */
elements: Record<string, UIElement>;
/** Optional initial state to seed the state model.
* Components using statePath will read from / write to this state. */
state?: Record<string, unknown>;
}
However, UIElement is a fully generic type:
interface UIElement<T extends string = string, P = Record<string, unknown>> {
/** Component type from the catalog */
type: T;
/** Component props */
props: P;
// ...
I wonder if we could add support for a Spec<T, P> type as well. For context, I want to pass Spec as a type to a React Hook Form form, but the type of elements should be limited to my own catalog only, and I have no way to that now without redefining Spec myself.
Thank you.
Hi, it seems like we don't support exporting a generic Spec type, currently
Speclooks like this:However,
UIElementis a fully generic type:I wonder if we could add support for a
Spec<T, P>type as well. For context, I want to passSpecas a type to a React Hook Form form, but the type ofelementsshould be limited to my own catalog only, and I have no way to that now without redefining Spec myself.Thank you.