mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 12:42:01 +00:00
Road to No Explicit Any Part 4: LiteGraph Cleanup (#7970)
## Summary - Remove all remaining `any` types from LiteGraph module - Define proper `Panel` interface for createPanel function and related callbacks - Type `SlotTypeDefaultNodeOpts` for slot type defaults configuration - Fix type inference issues in sendActionToCanvas and contextMenuCompat ## Changes - **SubgraphIONodeBase.ts**: Remove unnecessary `as any` cast in showSlotContextMenu - **interfaces.ts**: Add Panel, PanelButton, PanelWidget, PanelWidgetOptions, PanelWidgetCallback types - **LGraphNode.ts**: Type panel callbacks (onShowCustomPanelInfo, onAddPropertyToPanel) and onGetPropertyInfo - **LGraphCanvas.ts**: - Type node_panel and options_panel as Panel - Type inner_clicked callback parameters - Type local variables (nodeNewType, nodeNewOpts, prevent_timeout, iS, sIn, sOut) - Add SlotTypeDefaultNodeOpts interface for slot type configuration - **LGraph.ts**: Fix sendActionToCanvas type inference with proper array handling - **contextMenuCompat.ts**: Add null guard for newImpl parameter ## Test plan - [x] pnpm typecheck passes - [x] pnpm lint passes - [x] knip passes (no unused exports) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7970-Road-to-No-Explicit-Any-Part-4-LiteGraph-Cleanup-2e66d73d3650812c939bf9b2cb0ff2f5) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
committed by
GitHub
parent
81df0102f8
commit
3412a0908d
@@ -41,6 +41,7 @@ import type {
|
||||
INodeSlotContextItem,
|
||||
IPinnable,
|
||||
ISlotType,
|
||||
Panel,
|
||||
Point,
|
||||
Positionable,
|
||||
ReadOnlyRect,
|
||||
@@ -96,9 +97,12 @@ export type NodeId = number | string
|
||||
export type NodeProperty = string | number | boolean | object
|
||||
|
||||
interface INodePropertyInfo {
|
||||
name: string
|
||||
name?: string
|
||||
type?: string
|
||||
default_value: NodeProperty | undefined
|
||||
default_value?: NodeProperty
|
||||
widget?: string
|
||||
label?: string
|
||||
values?: TWidgetValue[]
|
||||
}
|
||||
|
||||
interface IMouseOverData {
|
||||
@@ -606,8 +610,8 @@ export class LGraphNode
|
||||
target_slot: number,
|
||||
requested_slot?: number | string
|
||||
): number | false | null
|
||||
onShowCustomPanelInfo?(this: LGraphNode, panel: any): void
|
||||
onAddPropertyToPanel?(this: LGraphNode, pName: string, panel: any): boolean
|
||||
onShowCustomPanelInfo?(this: LGraphNode, panel: Panel): void
|
||||
onAddPropertyToPanel?(this: LGraphNode, pName: string, panel: Panel): boolean
|
||||
onWidgetChanged?(
|
||||
this: LGraphNode,
|
||||
name: string,
|
||||
@@ -667,8 +671,7 @@ export class LGraphNode
|
||||
index: number,
|
||||
e: CanvasPointerEvent
|
||||
): void
|
||||
// TODO: Return type
|
||||
onGetPropertyInfo?(this: LGraphNode, property: string): any
|
||||
onGetPropertyInfo?(this: LGraphNode, property: string): INodePropertyInfo
|
||||
onNodeOutputAdd?(this: LGraphNode, value: unknown): void
|
||||
onNodeInputAdd?(this: LGraphNode, value: unknown): void
|
||||
onMenuNodeInputs?(
|
||||
|
||||
Reference in New Issue
Block a user