Skip to content

fix(app): annotate showAvatar to break TS7022 circular inference#326

Merged
graydawnc merged 1 commit into
mainfrom
fix/messagelist-showavatar-type
May 27, 2026
Merged

fix(app): annotate showAvatar to break TS7022 circular inference#326
graydawnc merged 1 commit into
mainfrom
fix/messagelist-showavatar-type

Conversation

@graydawnc
Copy link
Copy Markdown
Collaborator

What

buildRows in MessageList.tsx declared showAvatar with no type. Under the app's tsconfig.json, TypeScript flags it TS7022 — "implicitly has type 'any' because it is referenced directly or indirectly in its own initializer" — from a circular control-flow inference through the Row union (row = { kind: 'msg', msg, showAvatar }). Pinning showAvatar: boolean (the type Row's msg variant already requires) breaks the cycle.

Why

The error has been latent since #265. It never gated anything because the app build runs esbuild via electron-vite (no type-check) and CI's e2e.yml has only unit (vitest) + e2e (playwright) jobs — no tsc step. So pnpm -C packages/app exec tsc --noEmit reported it but nothing enforced it. This clears the one outstanding type error so the app package type-checks clean.

How it connects

Pure type annotation on one local; no runtime/behaviour change. The value is identical (!prevMsg || prevMsg.role !== msg.role || prevMsg.role === 'system').

Test plan

  • pnpm -C packages/app exec tsc --noEmit -p tsconfig.jsonwas 1 error (MessageList:128), now clean (exit 0), whole app package included.
  • Adjacent suites unaffected (no behaviour change); unit + e2e continue to pass.

Coverage note: this class of error can't be guarded by a runtime test, and the repo currently runs no tsc job in CI, so nothing automatically prevents recurrence. Out of scope here; a separate change could add a typecheck gate (the app package now type-checks clean, so such a gate would pass).

🤖 Generated with Claude Code

`buildRows` declared `showAvatar` without a type; under the app's
tsconfig TypeScript flagged TS7022 ("implicitly has type 'any' because
it is referenced directly or indirectly in its own initializer") from a
circular control-flow inference through the `Row` union. Pinning it to
`boolean` (the type `Row`'s msg variant already requires) breaks the
cycle. No behaviour change.

Latent since #265 — the app build runs esbuild (electron-vite) and CI
has no tsc step, so the type error never gated anything.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@graydawnc graydawnc added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit f90b0fa May 27, 2026
6 checks passed
@graydawnc graydawnc deleted the fix/messagelist-showavatar-type branch May 27, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant