@@ -140,43 +140,20 @@ export function useSlotLinkInteraction({
140
140
return 'canConnectToReroute' in link
141
141
}
142
142
143
- type InputConnectableLink = RenderLink & {
144
- toType : 'input'
145
- canConnectToInput : ( node : LGraphNode , input : INodeInputSlot ) => boolean
146
- }
147
-
148
- type OutputConnectableLink = RenderLink & {
149
- toType : 'output'
150
- canConnectToOutput : ( node : LGraphNode , output : INodeOutputSlot ) => boolean
151
- }
152
-
153
- function isInputConnectableLink (
154
- link : RenderLink
155
- ) : link is InputConnectableLink {
156
- return (
157
- link . toType === 'input' &&
158
- typeof ( link as { canConnectToInput ?: unknown } ) . canConnectToInput ===
159
- 'function'
160
- )
161
- }
162
-
163
- function isOutputConnectableLink (
164
- link : RenderLink
165
- ) : link is OutputConnectableLink {
166
- return (
167
- link . toType === 'output' &&
168
- typeof ( link as { canConnectToOutput ?: unknown } ) . canConnectToOutput ===
169
- 'function'
170
- )
171
- }
143
+ type ToInputLink = RenderLink & { toType : 'input' }
144
+ type ToOutputLink = RenderLink & { toType : 'output' }
145
+ const isToInputLink = ( link : RenderLink ) : link is ToInputLink =>
146
+ link . toType === 'input'
147
+ const isToOutputLink = ( link : RenderLink ) : link is ToOutputLink =>
148
+ link . toType === 'output'
172
149
173
150
function connectLinksToInput (
174
151
links : ReadonlyArray < RenderLink > ,
175
152
node : LGraphNode ,
176
153
inputSlot : INodeInputSlot
177
154
) : boolean {
178
155
const validCandidates = links
179
- . filter ( isInputConnectableLink )
156
+ . filter ( isToInputLink )
180
157
. filter ( ( link ) => link . canConnectToInput ( node , inputSlot ) )
181
158
182
159
for ( const link of validCandidates ) {
@@ -192,7 +169,7 @@ export function useSlotLinkInteraction({
192
169
outputSlot : INodeOutputSlot
193
170
) : boolean {
194
171
const validCandidates = links
195
- . filter ( isOutputConnectableLink )
172
+ . filter ( isToOutputLink )
196
173
. filter ( ( link ) => link . canConnectToOutput ( node , outputSlot ) )
197
174
198
175
for ( const link of validCandidates ) {
@@ -353,7 +330,7 @@ export function useSlotLinkInteraction({
353
330
if ( results . length && maybeReroutes !== null ) {
354
331
const originalReroutes = maybeReroutes . slice ( 0 , - 1 ) . reverse ( )
355
332
for ( const link of adapter . renderLinks ) {
356
- if ( ! isInputConnectableLink ( link ) ) continue
333
+ if ( ! isToInputLink ( link ) ) continue
357
334
for ( const result of results ) {
358
335
link . connectToRerouteInput (
359
336
reroute ,
@@ -370,7 +347,7 @@ export function useSlotLinkInteraction({
370
347
if ( sourceOutput ) {
371
348
const { node, output } = sourceOutput
372
349
for ( const link of adapter . renderLinks ) {
373
- if ( ! isOutputConnectableLink ( link ) ) continue
350
+ if ( ! isToOutputLink ( link ) ) continue
374
351
if ( hasCanConnectToReroute ( link ) && ! link . canConnectToReroute ( reroute ) )
375
352
continue
376
353
link . connectToRerouteOutput (
0 commit comments