refactor: remove any types from fuseUtil, ui, isobmff, and fix clipspace

- fuseUtil.ts: Changed isFuseSearchable type guard from any to unknown with proper null checks
- ui.ts: Changed Props index signature from any to unknown
- isobmff.ts: Changed extractJson return type from any to unknown with type assertion at call site
- clipspace.ts: Fixed pre-existing typecheck error by changing createImgSettings and createImgPreview to return null instead of empty array
This commit is contained in:
Johnpaul
2026-01-22 19:07:26 +01:00
parent 35139da175
commit 5683c388e4
4 changed files with 19 additions and 10 deletions

View File

@@ -47,8 +47,9 @@ export class ClipspaceDialog extends ComfyDialog {
if (ClipspaceDialog.instance) {
const self = ClipspaceDialog.instance
// allow reconstruct controls when copying from non-image to image content.
const imgSettings = self.createImgSettings()
const children = $el('div.comfy-modal-content', [
self.createImgSettings(),
...(imgSettings ? [imgSettings] : []),
...self.createButtons()
])
@@ -103,7 +104,7 @@ export class ClipspaceDialog extends ComfyDialog {
return buttons
}
createImgSettings() {
createImgSettings(): HTMLTableElement | null {
if (ComfyApp.clipspace?.imgs) {
const combo_items = []
const imgs = ComfyApp.clipspace.imgs
@@ -167,14 +168,14 @@ export class ClipspaceDialog extends ComfyDialog {
return $el('table', {}, [row1, row2, row3])
} else {
return []
return null
}
}
createImgPreview() {
createImgPreview(): HTMLImageElement | null {
if (ComfyApp.clipspace?.imgs) {
return $el('img', { id: 'clipspace_preview', ondragstart: () => false })
} else return []
} else return null
}
override show() {

View File

@@ -72,7 +72,7 @@ const findIsobmffBoxByType = (
return null
}
const extractJson = (data: Uint8Array, start: number, end: number): any => {
const extractJson = (data: Uint8Array, start: number, end: number): unknown => {
let jsonStart = start
while (jsonStart < end && data[jsonStart] !== ASCII.OPEN_BRACE) {
jsonStart++
@@ -133,7 +133,11 @@ const extractMetadataValueFromDataBox = (
lowerKeyName === ComfyMetadataTags.PROMPT.toLowerCase() ||
lowerKeyName === ComfyMetadataTags.WORKFLOW.toLowerCase()
) {
return extractJson(data, valueStart, dataBoxEnd) || null
return (
(extractJson(data, valueStart, dataBoxEnd) as
| ComfyWorkflowJSON
| ComfyApiWorkflow) || null
)
}
return null
}

View File

@@ -28,7 +28,7 @@ type Props = {
style?: Partial<CSSStyleDeclaration>
for?: string
textContent?: string
[key: string]: any
[key: string]: unknown
}
type Children = Element[] | Element | string | string[]

View File

@@ -75,8 +75,12 @@ export interface FuseSearchable {
postProcessSearchScores: (scores: SearchAuxScore) => SearchAuxScore
}
function isFuseSearchable(item: any): item is FuseSearchable {
return 'postProcessSearchScores' in item
function isFuseSearchable(item: unknown): item is FuseSearchable {
return (
typeof item === 'object' &&
item !== null &&
'postProcessSearchScores' in item
)
}
/**