[Type] Mark app as required arg for ComfyWidgetConstructor (#2518)

This commit is contained in:
Chenlei Hu
2025-02-11 11:39:23 -05:00
committed by GitHub
parent efe7843469
commit 8db101c1cb
6 changed files with 12 additions and 9 deletions

View File

@@ -2,12 +2,13 @@ import type { LGraphNode } from '@comfyorg/litegraph'
import type { IStringWidget } from '@comfyorg/litegraph/dist/types/widgets'
import { api } from '@/scripts/api'
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
import { useToastStore } from '@/stores/toastStore'
import type { ComfyApp } from '@/types'
import type { InputSpec } from '@/types/apiTypes'
export const useImageUploadWidget = () => {
const widgetConstructor = (
const widgetConstructor: ComfyWidgetConstructor = (
node: LGraphNode,
inputName: string,
inputData: InputSpec,

View File

@@ -15,7 +15,7 @@ export const useIntWidget = () => {
node: LGraphNode,
inputName: string,
inputData: InputSpec,
app?: ComfyApp,
app: ComfyApp,
widgetName?: string
) => {
const settingStore = useSettingStore()

View File

@@ -8,6 +8,7 @@ import TiptapTableRow from '@tiptap/extension-table-row'
import TiptapStarterKit from '@tiptap/starter-kit'
import { Markdown as TiptapMarkdown } from 'tiptap-markdown'
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
import type { ComfyApp } from '@/types'
import type { InputSpec } from '@/types/apiTypes'
@@ -101,13 +102,13 @@ function addMarkdownWidget(
}
export const useMarkdownWidget = () => {
const widgetConstructor = (
const widgetConstructor: ComfyWidgetConstructor = (
node: LGraphNode,
inputName: string,
inputData: InputSpec,
app: ComfyApp
) => {
const defaultVal = inputData[1].default || ''
const defaultVal = inputData[1]?.default || ''
return addMarkdownWidget(
node,
inputName,

View File

@@ -13,7 +13,7 @@ export const useSeedWidget = () => {
node: LGraphNode,
inputName: string,
inputData: InputSpec,
app?: ComfyApp,
app: ComfyApp,
widgetName?: string
) => {
inputData[1] = {

View File

@@ -1,5 +1,6 @@
import type { IWidget, LGraphNode } from '@comfyorg/litegraph'
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
import { useSettingStore } from '@/stores/settingStore'
import type { ComfyApp } from '@/types'
import type { InputSpec } from '@/types/apiTypes'
@@ -57,14 +58,14 @@ function addMultilineWidget(
}
export const useStringWidget = () => {
const widgetConstructor = (
const widgetConstructor: ComfyWidgetConstructor = (
node: LGraphNode,
inputName: string,
inputData: InputSpec,
app: ComfyApp
) => {
const defaultVal = inputData[1].default || ''
const multiline = !!inputData[1].multiline
const defaultVal = inputData[1]?.default || ''
const multiline = !!inputData[1]?.multiline
let res: { widget: IWidget }
if (multiline) {

View File

@@ -20,7 +20,7 @@ export type ComfyWidgetConstructor = (
node: LGraphNode,
inputName: string,
inputData: InputSpec,
app?: ComfyApp,
app: ComfyApp,
widgetName?: string
) => { widget: IWidget; minWidth?: number; minHeight?: number }