Typing: Slots in VueNodeData (#5759)

## Summary

Replace the unknown type with the interface in Litegraph.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-5759-Typing-Slots-in-VueNodeData-2786d73d36508194b286fad172b13c51)
by [Unito](https://www.unito.io)
This commit is contained in:
Alexander Brown
2025-09-24 14:35:14 -07:00
committed by GitHub
parent cd7666e3bc
commit 0fea54c542
3 changed files with 40 additions and 15 deletions

View File

@@ -38,6 +38,11 @@
import { computed } from 'vue'
import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
import type {
INodeInputSlot,
INodeOutputSlot
} from '@/lib/litegraph/src/interfaces'
import { RenderShape } from '@/lib/litegraph/src/litegraph'
import NodeContent from '@/renderer/extensions/vueNodes/components/NodeContent.vue'
import NodeHeader from '@/renderer/extensions/vueNodes/components/NodeHeader.vue'
import NodeSlots from '@/renderer/extensions/vueNodes/components/NodeSlots.vue'
@@ -74,26 +79,29 @@ const nodeData = computed<VueNodeData>(() => {
}
}))
const inputs = Object.entries(nodeDef.inputs || {})
const inputs: INodeInputSlot[] = Object.entries(nodeDef.inputs || {})
.filter(([_, input]) => !widgetStore.inputIsWidget(input))
.map(([name, input]) => ({
name,
type: input.type,
shape: input.isOptional ? 'HollowCircle' : undefined,
boundingRect: [0, 0, 0, 0]
shape: input.isOptional ? RenderShape.HollowCircle : undefined,
boundingRect: [0, 0, 0, 0],
link: null
}))
const outputs = (nodeDef.outputs || []).map((output) => {
const outputs: INodeOutputSlot[] = (nodeDef.outputs || []).map((output) => {
if (typeof output === 'string') {
return {
name: output,
type: output,
boundingRect: [0, 0, 0, 0]
boundingRect: [0, 0, 0, 0],
links: []
}
}
return {
...output,
boundingRect: [0, 0, 0, 0]
boundingRect: [0, 0, 0, 0],
links: []
}
})