Most Studio types (e.g. AgStudioApi and AgStudioProperties) include a TRegistry generic.
TRegistry allows for the Studio API types to reflect the customisations being provided in the properties.
If you are not providing any customisations, you can omit the generic, and it will fall back to the defaults.
If you are providing relevant customisations, you should extend the registry with your overrides.
Base Registry versus Default Registry Copy Link
The TRegistry generic in interface types extends AgBaseRegistry. The AgBaseRegistry properties are very broad so that they allow for any custom registry to be used.
The very top level generics on the Studio component use AgRegistry, which provides the correct custom component typing.
For the types to work properly, the registry property types requires mapped unions. This means instead of providing a type SomeDefinition<'a' | 'b'>, you would provide SomeDefinition<'a'> | SomeDefinition<'b'>.
This can be seen in the default registry AgDefaultRegistry.
Types for custom widget definitions. |
Types for custom components. |
Providing a Custom Registry Copy Link
export interface CustomRegistry extends AgRegistry {
widgets: readonly (CustomWidgetDefinition | AgDefaultWidgetDefinition)[];
}
The above registry adds a custom widget definition type to the existing widget types. AgDefaultWidgetDefinition consists of all of the default widget definition types.