Stricter typing for nodeids

This commit is contained in:
Austin Mroz
2025-09-23 16:45:46 -05:00
parent 109173fad1
commit 5ea7a56b64
8 changed files with 35 additions and 29 deletions

View File

@@ -16,7 +16,6 @@ vi.mock('@/platform/workflow/management/stores/workflowStore', () => ({
// Remove any previous global types
declare global {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface Window {}
}
@@ -148,7 +147,7 @@ describe('useExecutionStore - NodeLocatorId conversions', () => {
})
it('should handle numeric node IDs', () => {
const result = store.executionIdToNodeLocatorId(123)
const result = store.executionIdToNodeLocatorId('123')
// For numeric IDs, it should convert to string and return as-is
expect(result).toBe('123')

View File

@@ -1,5 +1,6 @@
import { describe, expect, it, vi } from 'vitest'
import type { NodeId } from '@/lib/litegraph/src/LGraphNode'
import type {
LGraph,
LGraphNode,
@@ -61,7 +62,7 @@ function createMockSubgraph(id: string, nodes: LGraphNode[]): Subgraph {
id,
_nodes: nodes,
nodes: nodes,
getNodeById: (nodeId: string | number) =>
getNodeById: (nodeId: NodeId) =>
nodes.find((n) => String(n.id) === String(nodeId)) || null
} as unknown as Subgraph
}