hooksfix(mail): clear 309 typecheck errors and 5 live ReferenceErrors apps/mail 792 -> 483. Jest stays green at 111 suites / 1071 tests. The single biggest cluster was one missing line: tsconfig pins `types` to ["node","vite/client","jest"] and jest.setup.js is a .js file outside `include`, so the @testing-library/jest-dom matcher augmentation never entered the program — 170 errors from `expect(...).toBeInTheDocument()` and friends. A 4-line jest-dom.d.ts clears all of them. Stripping @jest/globals from 22 test files was a prerequisite, not a tidy-up: only the globally-injected `expect` picks up that augmentation. The other 145 test files already used injected globals, so this also converges on the dominant convention. Do not install @jest/globals. The rest: CRM store test fixtures still extending state that moved to conversationsSlice in Dec 2025 and importing a deleted CRMTypes module; barrel files re-exporting modules that no longer exist (each one an import-time throw); a locally-declared SelectorItem whose module was deleted; sanitizeJson taking `object` when its body explicitly handles primitives and both callers already cast. Five of these were live runtime bugs, not type noise: - setForcePropagate(false) in the AOP-save onSuccess threw on EVERY successful playbook save (cedarAdmin/page.tsx, admin/page.tsx) - backendResponsiveness referenced in a useMemo dependency array, evaluated every render, while the memo body no longer mentions it - "Force re-sync" called handleForceSync() with no argument against a z.object() input that rejects undefined, so it always failed validation - an empty-string icon key produced `Icon === ''`, i.e. <'' /> - showOverlay leaked an unknown attribute onto a Radix DOM node Worth knowing separately: the 792 were invisible. Plain tsc reported 3, because a syntax error elsewhere in the tree makes TypeScript skip ALL semantic checking. One stray comma blinds the entire typecheck. Co-Authored-By: Claude Opus 5 (1M context) <<email>>Aug 2, 2026, 2:11 PM