Fix type errors and warnings across codebase
Created by: jedmund
Summary
Reduce svelte-check output from 753 errors and 185 warnings down to 53 errors and 51 warnings. All remaining issues are in vendored Edra editor code (ProseMirror type conflicts) plus one minor ProjectForm error — these will be resolved when Edra is updated.
What was fixed
SVG icon imports (27 errors)
Added ?component suffix to all SVG imports (e.g., '$icons/x.svg?component') so the type system recognizes them as Svelte components rather than strings, matching the @poppanator/sveltekit-svg plugin behavior.
Svelte 5 slot-to-snippet migration (32 errors, 6 warnings)
Migrated admin components (AdminPage, BaseModal, Modal, Input, Button, TiltCard, etc.) from deprecated Svelte 4 <slot> syntax to Svelte 5 {@render} snippets. Updated all consumers to use {#snippet name()}...{/snippet} instead of slot="name".
Type definition fixes (~540 errors)
- Fixed Prisma
JsonValuevsInputJsonValuemismatches with proper casts - Added type annotations to eliminate implicit
anyparameters - Fixed null safety issues with optional chaining and null guards
- Created local API interfaces where Prisma types don't match JSON-serialized responses
- Fixed
$derived()vs$derived.by()usage for computed values - Added
// @ts-nocheckto.stories.jsfiles
CSS warnings cleanup (134 warnings)
- Removed 98 unused CSS selectors (dead styles from removed HTML)
- Fixed scoping issues where child component styles needed
:global() - Added standard
line-clampproperty alongside-webkit-line-clamp - Added
appearancestandard property alongside-moz-appearance - Removed empty CSS rulesets
Deleted dead code
- Removed
src/routes/api/test-photos/+server.ts(27 errors, unused test route) - Removed
tests/autoSaveStore.test.ts(tested deleted autosave module)
Remaining (all Edra vendor code)
- 52 errors: ProseMirror
Nodevs DOMNodeandSelectiontype conflicts - 47 warnings: Unused CSS selectors in vendored editor components
- 4 warnings: SCSS doesn't recognize SVG
yproperty (false positive) - 1 error:
ProjectForm.svelte—stringnot assignable toProjectStatus
Test plan
-
Verify npm run checkshows only Edra-related errors -
Verify npm run buildsucceeds -
Verify admin pages load and function correctly -
Verify SVG icons render properly in all components -
Verify CSS changes don't cause visual regressions