I have a function that takes 2 types.
handleDragging(e: CustomEvent<SelectionHandleDragEventType | GridHandleDragEventType>) {
e.stopPropagation();
const newValue = this.computeValuesFromPosition(e.detail.x, e.detail.y, e.detail.variant);
// other same code
})
the issue is that GridHandleDragEventType
does not have a variant
as part of the type. In those cases, I don’t mind sending null
but I keep getting the TS issue:
Property 'variant' does not exist on type 'GridHandleDragEventType'.
Is there a clean way to resolve this?