From 5e56dd58c01d61e955f3564e17e7d423dcbc51f9 Mon Sep 17 00:00:00 2001 From: moklick Date: Sun, 18 Feb 2024 19:54:55 +0100 Subject: [PATCH] chore(types): cleanup --- packages/svelte/src/lib/store/initial-store.ts | 2 +- packages/system/src/types/nodes.ts | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/svelte/src/lib/store/initial-store.ts b/packages/svelte/src/lib/store/initial-store.ts index 40020aba..9c077ba0 100644 --- a/packages/svelte/src/lib/store/initial-store.ts +++ b/packages/svelte/src/lib/store/initial-store.ts @@ -79,7 +79,7 @@ export const getInitialStore = ({ height?: number; fitView?: boolean; }) => { - const nodeLookup = new Map(); + const nodeLookup: NodeLookup = new Map(); const nextNodes = adoptUserProvidedNodes(nodes, nodeLookup, { nodeOrigin: [0, 0], elevateNodesOnSelect: false diff --git a/packages/system/src/types/nodes.ts b/packages/system/src/types/nodes.ts index 4ac854ed..aadd4a47 100644 --- a/packages/system/src/types/nodes.ts +++ b/packages/system/src/types/nodes.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { internalsSymbol } from '../constants'; import type { XYPosition, Position, CoordinateExtent, HandleElement } from '.'; import { Optional } from '../utils/types'; @@ -6,8 +5,8 @@ import { Optional } from '../utils/types'; /** * Framework independent node data structure. * - * @typeParam T - type of the node data - * @typeParam U - type of the node + * @typeParam NodeData - type of the node data + * @typeParam NodeType - type of the node */ export type NodeBase< NodeData extends Record = Record, @@ -77,17 +76,16 @@ export type NodeBase< }; }; -// props that get passed to a custom node /** * The node data structure that gets used for the nodes prop. * * @public * @param id - The id of the node. */ -export type NodeProps = { - /** Id of the node */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type NodeProps = { id: NodeBase['id']; - data: T; + data: NodeData; dragHandle: NodeBase['dragHandle']; type: NodeBase['type']; selected: NodeBase['selected'];