import type { AgTypeScriptComponent } from './agCustomComp'; import type { AgBaseRegistry, AgWidgetRegistry } from './agRegistry'; import type { AgWidgetParams } from './agWidgetParams'; import type { AgDefaultWidgetType } from './widgets/agDefaultWidget'; import type { AgBaseWidgetDefinition } from './widgets/agWidgetDefinition'; import type { AgWidgetData, AgWidgetDataFormat } from './widgets/shared/agWidget'; export interface AgTypeScriptWidgetDefinition> = any, TOut extends AgWidgetData> = TIn, TOptions = unknown> extends AgBaseWidgetDefinition { /** * Custom component. Either: * - A `string` that matches a custom component in the studio `components` property * - A custom TypeScript component class */ comp: string | (new () => AgTypeScriptComponent>); } type StringCompWidgetType = TDef['comp'] extends string ? TDef : never; type ExtractStateFromDef = TDef extends AgTypeScriptWidgetDefinition ? TState : never; type MatchingDef = TDef extends { id: TWidgetType; } ? TDef : never; export type AgTypeScriptCustomComponentDefs = { [K in Exclude>['comp'], AgDefaultWidgetType>]?: new () => AgTypeScriptComponent, K>>>>; }; export interface AgTypeScriptRegistry extends AgBaseRegistry { widgets: readonly AgTypeScriptWidgetDefinition[]; components: AgTypeScriptCustomComponentDefs; } export {};