Files
ComfyUI_frontend/src/scripts
Johnpaul Chiwetelu 941cd2b4a5 refactor: improve TypeScript patterns in test files (Group 1/8) (#8253)
## Summary
Improves type safety in test files by replacing unsafe type patterns
with proper TypeScript idioms.

## Changes
- Define typed `TestWindow` interface extending `Window` for Playwright
tests with custom properties
- Use `Partial<HTMLElement>` with single type assertion for DOM element
mocks
- Remove redundant type imports
- Fix `console.log` → `console.warn` in test fixture

## Files Changed
16 test files across browser_tests, packages, and src/components

## Test Plan
-  `pnpm typecheck` passes
-  No new `any` types introduced
-  All pre-commit hooks pass

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8253-refactor-improve-TypeScript-patterns-in-test-files-Group-1-8-2f16d73d365081548f9ece7bcf0525ee)
by [Unito](https://www.unito.io)

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-01-23 02:35:09 +01:00
..
2025-12-10 11:08:47 -08:00

Scripts Directory Documentation

This directory contains TypeScript code inherited from the legacy ComfyUI JavaScript frontend project. The code has been migrated from JavaScript to TypeScript while maintaining compatibility with the original functionality.

When implementing new features, prefer using the new Vue3 system over the legacy scripts.

Key Components

ComfyApi (api.ts)

Main API client class that handles communication with the ComfyUI backend. Provides methods for:

  • Queue management
  • Model operations
  • Extension handling
  • WebSocket communication
  • User data management

ComfyApp (app.ts)

Core application class that manages:

  • Graph manipulation
  • Node management
  • Canvas interactions
  • Extension system
  • Workflow state

UI Components (ui/)

Collection of reusable UI components including:

  • Buttons and button groups
  • Popups and dialogs
  • Draggable lists
  • Image previews
  • Menu system
  • Settings dialog

Integration with Vite

All TypeScript exports are shimmed through Vite configuration to maintain compatibility with the legacy JavaScript codebase. The shimming logic can be found in vite.config.mts.

Legacy Compatibility

This codebase maintains compatibility with the original ComfyUI Legacy Frontend while providing TypeScript type safety and modern development features.

For users wanting to fall back to the legacy frontend, use the command line argument:

--front-end-version Comfy-Org/ComfyUI_legacy_frontend@latest