widgetize: Refactor type for 'extra_data'.

This commit is contained in:
Varun Singh 2024-03-28 21:01:50 +05:30 committed by Tim Abbott
parent 894756addc
commit c29fbeca94
1 changed files with 4 additions and 2 deletions

View File

@ -12,9 +12,11 @@ type ZFormExtraData = {
choices: {type: string; reply: string; long_name: string; short_name: string}[]; choices: {type: string; reply: string; long_name: string; short_name: string}[];
}; };
type WidgetExtraData = PollWidgetExtraData | ZFormExtraData | null;
type WidgetOptions = { type WidgetOptions = {
widget_type: string; widget_type: string;
extra_data: PollWidgetExtraData | ZFormExtraData | null; extra_data: WidgetExtraData;
events: Event[]; events: Event[];
$row: JQuery; $row: JQuery;
message: Message; message: Message;
@ -26,7 +28,7 @@ type WidgetValue = Record<string, unknown> & {
$elem: JQuery; $elem: JQuery;
callback: (data: string) => void; callback: (data: string) => void;
message: Message; message: Message;
extra_data: WidgetOptions["extra_data"]; extra_data: WidgetExtraData;
}) => void; }) => void;
}; };