From a9a2f773409de31dbc81ba3995073459875d89b4 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 27 Dec 2024 20:28:56 +0100 Subject: [PATCH] Type anys --- .../src/components/grid/stores/reorder.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/frontend-core/src/components/grid/stores/reorder.ts b/packages/frontend-core/src/components/grid/stores/reorder.ts index 1481b96f29..ba606626e3 100644 --- a/packages/frontend-core/src/components/grid/stores/reorder.ts +++ b/packages/frontend-core/src/components/grid/stores/reorder.ts @@ -2,11 +2,17 @@ import { get, writable, derived, Writable, Readable } from "svelte/store" import { parseEventLocation } from "../lib/utils" import { Store as StoreContext } from "." +interface Breakpoint { + x: number + column: string + insertAfter: boolean +} + interface ReorderInitialStoreData { - sourceColumn: any - targetColumn: any + sourceColumn: string | null + targetColumn: string | null insertAfter?: boolean - breakpoints: any[] + breakpoints: Breakpoint[] gridLeft: number width: number increment?: number @@ -140,7 +146,7 @@ export const createActions = (context: StoreContext) => { const $scrollLeft = get(scrollLeft) // Compute the closest breakpoint to the current position - let breakpoint: any + let breakpoint: Breakpoint | undefined let minDistance = Number.MAX_SAFE_INTEGER const mouseX = latestX - $reorder.gridLeft + $scrollLeft $reorder.breakpoints.forEach(point => { @@ -157,8 +163,8 @@ export const createActions = (context: StoreContext) => { ) { reorder.update(state => ({ ...state, - targetColumn: breakpoint.column, - insertAfter: breakpoint.insertAfter, + targetColumn: breakpoint!.column, + insertAfter: breakpoint!.insertAfter, })) } }