@@ -9,6 +9,7 @@ import type { ResultItem } from '@/schemas/apiSchema'
99import type { InputSpec } from '@/schemas/nodeDefSchema'
1010import type { ComfyWidgetConstructor } from '@/scripts/widgets'
1111import { useNodeOutputStore } from '@/stores/imagePreviewStore'
12+ import { isImageUploadInput } from '@/types/nodeDefAugmentation'
1213import { createAnnotatedPath } from '@/utils/formatUtil'
1314import { addToComboValues } from '@/utils/litegraphUtil'
1415
@@ -33,7 +34,13 @@ export const useImageUploadWidget = () => {
3334 inputName : string ,
3435 inputData : InputSpec
3536 ) => {
36- const inputOptions = inputData [ 1 ] ?? { }
37+ if ( ! isImageUploadInput ( inputData ) ) {
38+ throw new Error (
39+ 'Image upload widget requires imageInputName augmentation'
40+ )
41+ }
42+
43+ const inputOptions = inputData [ 1 ]
3744 const { imageInputName, allow_batch, image_folder = 'input' } = inputOptions
3845 const nodeOutputStore = useNodeOutputStore ( )
3946
@@ -43,11 +50,9 @@ export const useImageUploadWidget = () => {
4350 const { showPreview } = isVideo ? useNodeVideo ( node ) : useNodeImage ( node )
4451
4552 const fileFilter = isVideo ? isVideoFile : isImageFile
46- // @ts -expect-error InputSpec is not typed correctly
4753 const fileComboWidget = findFileComboWidget ( node , imageInputName )
4854 const initialFile = `${ fileComboWidget . value } `
4955 const formatPath = ( value : InternalFile ) =>
50- // @ts -expect-error InputSpec is not typed correctly
5156 createAnnotatedPath ( value , { rootFolder : image_folder } )
5257
5358 const transform = ( internalValue : InternalValue ) : ExposedValue => {
@@ -67,7 +72,6 @@ export const useImageUploadWidget = () => {
6772
6873 // Setup file upload handling
6974 const { openFileSelection } = useNodeImageUpload ( node , {
70- // @ts -expect-error InputSpec is not typed correctly
7175 allow_batch,
7276 fileFilter,
7377 accept,
0 commit comments