[API] Add reroute convenience methods (#812)

Adds `LGraph.getReroute`, which accepts null & undefined IDs. Interface
overloads result in `never` when given a _known_ `undefined` or `null`
value.
This commit is contained in:
filtered
2025-03-22 05:58:07 +11:00
committed by GitHub
parent cdbc0fa5e5
commit a043e7a72e
3 changed files with 18 additions and 0 deletions

View File

@@ -116,6 +116,8 @@ export interface ReadonlyLinkNetwork {
readonly reroutes: ReadonlyMap<RerouteId, Reroute>
readonly floatingLinks: ReadonlyMap<LinkId, LLink>
getNodeById(id: NodeId): LGraphNode | null
getReroute(parentId: null | undefined): undefined
getReroute(parentId: RerouteId | null | undefined): Reroute | undefined
}
/**
@@ -126,6 +128,7 @@ export interface LinkNetwork extends ReadonlyLinkNetwork {
readonly reroutes: Map<RerouteId, Reroute>
addFloatingLink(link: LLink): LLink
removeReroute(id: number): unknown
removeFloatingLink(link: LLink): void
}
/**