From 2afa104c39bb624e848dad898ca99d2a5f95045b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 27 Dec 2024 20:31:49 +0100 Subject: [PATCH] Type anys --- packages/frontend-core/src/components/grid/lib/utils.ts | 4 +++- .../frontend-core/src/components/grid/stores/reorder.ts | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/frontend-core/src/components/grid/lib/utils.ts b/packages/frontend-core/src/components/grid/lib/utils.ts index 14aee663b7..3dd2d1ddd5 100644 --- a/packages/frontend-core/src/components/grid/lib/utils.ts +++ b/packages/frontend-core/src/components/grid/lib/utils.ts @@ -14,7 +14,9 @@ export const getCellID = (rowId: string, fieldName: string) => { return `${rowId}${CellIDSeparator}${fieldName}` } -export const parseEventLocation = (e: MouseEvent & TouchEvent) => { +export const parseEventLocation = (event: MouseEvent | TouchEvent) => { + const e = event as MouseEvent & TouchEvent + return { x: e.clientX ?? e.touches?.[0]?.clientX, y: e.clientY ?? e.touches?.[0]?.clientY, diff --git a/packages/frontend-core/src/components/grid/stores/reorder.ts b/packages/frontend-core/src/components/grid/stores/reorder.ts index ba606626e3..8f602ab836 100644 --- a/packages/frontend-core/src/components/grid/stores/reorder.ts +++ b/packages/frontend-core/src/components/grid/stores/reorder.ts @@ -64,11 +64,11 @@ export const createActions = (context: StoreContext) => { maxScrollLeft, } = context let latestX = 0 - let autoScrollInterval: any + let autoScrollInterval: NodeJS.Timeout let isAutoScrolling: boolean // Callback when dragging on a colum header and starting reordering - const startReordering = (column: any, e: any) => { + const startReordering = (column: string, e: MouseEvent | TouchEvent) => { const $scrollableColumns = get(scrollableColumns) const $bounds = get(bounds) const $stickyWidth = get(stickyWidth) @@ -113,7 +113,7 @@ export const createActions = (context: StoreContext) => { // Callback when moving the mouse when reordering columns const onReorderMouseMove = (e: MouseEvent | TouchEvent) => { // Immediately handle the current position - const { x } = parseEventLocation(e as any) + const { x } = parseEventLocation(e) latestX = x considerReorderPosition()