From ec0de61cf71d7924b68b2cc8d7308cd2b89cfcc7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 10 Jan 2025 11:57:06 +0100 Subject: [PATCH] Types --- packages/client/src/components/Component.svelte | 2 +- packages/client/src/utils/grid.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 7a1341c67c..79b4ca6f68 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -39,7 +39,7 @@ getActionContextKey, getActionDependentContextKeys, } from "../utils/buttonActions.js" - import { gridLayout } from "utils/grid.js" + import { gridLayout } from "utils/grid" export let instance = {} export let parent = null diff --git a/packages/client/src/utils/grid.ts b/packages/client/src/utils/grid.ts index eec2c9c173..519f47f342 100644 --- a/packages/client/src/utils/grid.ts +++ b/packages/client/src/utils/grid.ts @@ -48,11 +48,13 @@ export const getGridVar = (device: string, param: string) => `--grid-${device}-${param}` // Determines whether a JS event originated from immediately within a grid -export const isGridEvent = (e: any) => { +export const isGridEvent = (e: Event & { target: HTMLElement }): boolean => { return ( e.target.dataset?.indicator === "true" || + // @ts-expect-error: api is not properly typed e.target .closest?.(".component") + // @ts-expect-error ?.parentNode.closest(".component") ?.childNodes[0]?.classList?.contains("grid") ) @@ -101,7 +103,7 @@ export const gridLayout = (node: HTMLDivElement, metadata: any) => { } width += 2 * GridSpacing height += 2 * GridSpacing - let vars: any = { + const vars: Record = { "--default-width": width, "--default-height": height, }