Chore: Typescript cleanup (1 / N) (#7817)

## Summary

Remove 178 `@ts-expect-error` suppressions (935 → 757, 19% reduction) by
fixing underlying type issues instead of suppressing errors.

## Changes

- **What**: Type safety improvements across `src/lib/litegraph/` and
related test files
  - Prefix unused callback parameters with `_` instead of suppressing
  - Use type intersections for mock methods on real objects
  - Use `Partial<T>` for incomplete test objects instead of `as unknown`
  - Add non-null assertions after `.toBeDefined()` checks in tests
  - Let TypeScript infer vitest fixture parameter types
- **Breaking**: None

## Review Focus

- `LGraphCanvas.ts` has the largest changes (232 lines) — all mechanical
unused parameter fixes
- Test files use type intersection pattern for mocks: `node as
LGraphNode & { mockFn: ... }`
- Removed dead code: `src/platform/cloud/onboarding/auth.ts` (47 lines,
unused)

### Key Files
| File | Change |
|------|--------|
| `LGraphCanvas.ts` | 57 suppressions removed (unused params) |
| `subgraph/__fixtures__/*` | Fixture type improvements |
| `*.test.ts` files | Mock typing with intersections |

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7817-WIP-Chore-Typescript-cleanup-2da6d73d365081d1ade9e09a6c5bf935)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Alexander Brown
2026-01-06 15:47:50 -08:00
committed by GitHub
parent 76a0b0b4b4
commit 43f0ac2e8f
26 changed files with 249 additions and 450 deletions

View File

@@ -679,7 +679,12 @@ export class LGraphNode
this: LGraphNode,
entries: (IContextMenuValue<INodeSlotContextItem> | null)[]
): (IContextMenuValue<INodeSlotContextItem> | null)[]
onMouseUp?(this: LGraphNode, e: CanvasPointerEvent, pos: Point): void
onMouseUp?(
this: LGraphNode,
e: CanvasPointerEvent,
pos: Point,
canvas: LGraphCanvas
): void
onMouseEnter?(this: LGraphNode, e: CanvasPointerEvent): void
/** Blocks drag if return value is truthy. @param pos Offset from {@link LGraphNode.pos}. */
onMouseDown?(
@@ -2769,8 +2774,7 @@ export class LGraphNode
!LiteGraph.allow_multi_output_for_events
) {
graph.beforeChange()
// @ts-expect-error Unused param
this.disconnectOutput(slot, false, { doProcessChange: false })
this.disconnectOutput(slot)
}
}