From a12b3cb51a1e291301e75407a250aa418e191332 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 23 Nov 2025 13:36:47 +0200 Subject: [PATCH] chore(react/promoted_attributes): fix type issue --- apps/client/src/widgets/PromotedAttributes.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/PromotedAttributes.tsx b/apps/client/src/widgets/PromotedAttributes.tsx index 629585869..1d3823da5 100644 --- a/apps/client/src/widgets/PromotedAttributes.tsx +++ b/apps/client/src/widgets/PromotedAttributes.tsx @@ -31,6 +31,9 @@ interface CellProps { setCellToFocus(cell: Cell): void; } +type OnChangeEventData = TargetedEvent | InputEvent | JQuery.TriggeredEvent; +type OnChangeListener = (e: OnChangeEventData) => Promise; + export default function PromotedAttributes() { const { note, componentId } = useNoteContext(); const [ cells, setCells ] = usePromotedAttributeData(note, componentId); @@ -378,7 +381,7 @@ function InputButton({ icon, className, title, onClick }: { ) } -function setupTextLabelAutocomplete(el: HTMLInputElement, valueAttr: Attribute, onChangeListener: TargetedEvent) { +function setupTextLabelAutocomplete(el: HTMLInputElement, valueAttr: Attribute, onChangeListener: OnChangeListener) { // no need to await for this, can be done asynchronously const $input = $(el); server.get(`attribute-values/${encodeURIComponent(valueAttr.name)}`).then((_attributeValues) => { @@ -415,8 +418,8 @@ function setupTextLabelAutocomplete(el: HTMLInputElement, valueAttr: Attribute, }); } -function buildPromotedAttributeLabelChangedListener({ note, cell, componentId, ...props }: CellProps) { - return async (e: TargetedEvent | InputEvent) => { +function buildPromotedAttributeLabelChangedListener({ note, cell, componentId, ...props }: CellProps): OnChangeListener { + return async (e: OnChangeEventData) => { const inputEl = e.target as HTMLInputElement; let value: string;