Skip to content

Ban any, unknown and casts through unknown in the client (GRYT-1792) - #890

Merged
grytchat merged 3 commits into
mainfrom
claude/GRYT-1792-no-double-casts
Oct 19, 2026
Merged

grytchat merged 3 commits into
mainfrom
claude/GRYT-1792-no-double-casts

Conversation

@grytchat

@grytchat grytchat commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Sivert wants any and unknown to be errors, with every existing use either fixed or excepted with a reason, and the goal of emptying the exceptions.

Rules (.eslintrc.cjs)

  • @typescript-eslint/no-explicit-any: error.
  • no-restricted-syntax for x as unknown as Y: error.
  • @typescript-eslint/ban-types with unknown: error.

Exceptions, in the config rather than in each file
Files that still use unknown are listed under overrides, grouped by why. The goal is to empty these lists:

Why Files
socket payloads arrive unchecked and are validated there 43
stored and parsed data arrives unchecked and is validated there 32
IPC messages and files on disk arrive unchecked 22
responses from other services arrive unchecked 13
caught errors are unknown until checked 7
not typed yet 25

e2e/** is exempt, because tests read hooks off window. The review-required common/src/auth/** is exempt too, so it isn't touched here.

Fixed rather than excepted (the only code files in this PR)

  • socketConnection: unknown plus as Socket in 9 components and hooks is now Socket | null.
  • window and worker globalThis assignments use Object.assign.
  • remarkMention: the mention node is declared in mdast's PhrasingContentMap and checked with satisfies.
  • Pairing historyRecords builds the attachment key from the fields it checks, instead of a double cast. What it accepts is unchanged.
  • Three casts stay, each with a reason on the line: SendQueue and MLS SessionSocket (socket.io's generic on/off), and electron-updater's read-only currentVersion.

18 files. yarn lint, check-comment-length and the mention, history, search, send-queue, plugin, ai-toolkit and pairing checks pass.

Vikunja: GRYT-1792

🤖 Generated with Claude Code

grytchat and others added 2 commits October 19, 2026 09:45
any is an error. A cast through unknown (x as unknown as Y) is an error.
unknown itself is an error too: our own values get real types. A file that
parses outside input carries one disable at the top saying why, and the
goal is to remove each.

Fixed rather than disabled: the internal socket props typed unknown and
cast back to Socket (ChatView, ForumView, MobileServerView, SearchPanel,
useChatActions, useForum, useMessageSearch, usePins, useThreads), the
window and worker globals, the remark mention node, and pairing's
attachment keys, which also check iv now. The SendQueue and MLS session
casts stay with a reason: socket.io's generic on and off don't fit those
small interfaces.

157 files carry a disable. The 21 marked "not typed yet" are the first to
fix. Review-required auth files are exempted in the config, not in the
files, and so is e2e.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (GRYT-1792)

A disable comment at the top of 142 files made the PR unreviewable. The
exceptions are now lists in .eslintrc.cjs, grouped by why each file still
uses unknown, so the only code files this touches are the ones actually
fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The iv check changed which records survive pairing; check-pairing-approver
expects an attachment key with only id and key to come through. Only the
type fix stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grytchat
grytchat merged commit b404ac5 into main Oct 19, 2026
19 checks passed
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