fix(app): annotate showAvatar to break TS7022 circular inference#326
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
buildRowsinMessageList.tsxdeclaredshowAvatarwith no type. Under the app'stsconfig.json, TypeScript flags itTS7022— "implicitly has type 'any' because it is referenced directly or indirectly in its own initializer" — from a circular control-flow inference through theRowunion (row = { kind: 'msg', msg, showAvatar }). PinningshowAvatar: boolean(the typeRow'smsgvariant 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.ymlhas onlyunit(vitest) +e2e(playwright) jobs — notscstep. Sopnpm -C packages/app exec tsc --noEmitreported 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.json— was 1 error (MessageList:128), now clean (exit 0), whole app package included.unit+e2econtinue to pass.🤖 Generated with Claude Code