- Fix RequestOptions cache type incompatibility in adapters/types.ts - Add missing properties to Character type in entity.adapter.ts and entities.ts - Create adapters index.ts for module exports - Update users.ts to use userAdapter instead of removed core module - Fix UserSettingsModal.svelte switch import and type errors - Add type shims for wx-svelte-grid and $env/static/public - Accept upstream versions for SearchSidebar.svelte and teams/new/+page.svelte - Add CLEANUP_PLAN.md documenting remaining work Reduces type errors from ~412 to ~378. See CLEANUP_PLAN.md for remaining fixes. Co-Authored-By: Justin Edmund <justin@jedmund.com>
6 KiB
6 KiB
Svelte-Main Branch Cleanup Plan
Overview
This document outlines the remaining work needed to clean up the svelte-main branch and get the build green.
Completed Fixes
1. Environment/Generated Module Issues
- Ran Paraglide codegen to generate translation files in
src/lib/paraglide/ - Added type declarations for
$env/static/publicmodule insrc/lib/types/declarations.d.ts
2. Broken Imports from Removed Legacy API Layer
- Updated
SearchSidebar.svelteto use new adapter layer - Updated
Party.svelteto use new adapter layer - Updated
teams/new/+page.svelteto use new adapter layer
3. Type Shims for External Libraries
- Added comprehensive type declarations for
wx-svelte-gridinsrc/lib/types/declarations.d.ts
4. RequestOptions Cache Type Incompatibility
- Fixed
RequestOptionsinterface insrc/lib/api/adapters/types.tsto exclude 'cache' from RequestInit extension - Added both
cacheTime?: numberandcache?: RequestCacheproperties - Updated
base.adapter.tsto usecacheTimeinstead ofcachefor duration
5. Users Resource Module
- Updated
src/lib/api/resources/users.tsto useuserAdapterinstead of removed../coremodule - Changed function signature from
update(fetch, userId, params)toupdate(userId, params)
6. UserSettingsModal.svelte Fixes
- Fixed Switch import path (case sensitivity:
switch.svelte->Switch.svelte) - Fixed
users.updatecall signature - Removed invalid footer snippet definition
- Removed unused
Snippetimport
7. Character Type in Entity Adapter
- Added missing properties to Character type in
entity.adapter.ts:gender?: numberproficiency?: number[]race?: number[]hp?: { minHp, maxHp, maxHpFlb }atk?: { minAtk, maxAtk, maxAtkFlb }uncap?: { flb, ulb, transcendence }
8. Adapters Index File
- Created
src/lib/api/adapters/index.tsto export all adapters and types
9. Character Type in Entities
- Added missing properties to Character type in
src/lib/types/api/entities.ts:gender,race,proficiency,hp,atk
Remaining Type Errors (~378 errors)
High Priority (Most Impactful)
1. 'firstItem' and 'item' Possibly Undefined (27 errors)
- Location:
src/routes/teams/new/+page.svelte - Issue: TypeScript strict null checks flagging array access without null guards
- Fix: Add null checks before accessing
items[0]and in forEach loops
2. PartyCtx Missing openPicker Property (8 errors)
- Location: Various components using party context
- Issue:
PartyCtxtype doesn't includeopenPickermethod - Fix: Update
PartyCtxtype definition to includeopenPickermethod
3. Missing Paraglide Translation Keys (18 errors)
- Keys:
context_view_details,context_replace,context_remove - Location:
src/lib/paraglide/messages - Fix: Add missing translation keys to
project.inlang/messages/en.jsonandja.json
4. Summon/Weapon Missing hp/atk Properties (18 errors)
- Location: Entity adapter types
- Issue: Summon and Weapon types in
entity.adapter.tsneed hp/atk properties - Fix: Update Summon type to include
hpandatknested objects
Medium Priority
5. exactOptionalPropertyTypes Violations (~15 errors)
- Issue: Props with
undefinedvalues being passed to components that don't accept undefined - Fix: Update component Props interfaces to accept
undefinedfor optional properties
6. Select.svelte ItemIndicator Errors (4 errors)
- Issue:
Select.ItemIndicatordoesn't exist in bits-ui - Fix: Check bits-ui documentation for correct component name or remove usage
7. Button.svelte Icon Type Issues (2 errors)
- Issue:
iconprop isstring | undefinedbut Icon component expectsstring - Fix: Add conditional rendering or default value for icon prop
8. DropdownItem.svelte asChild Issue (2 errors)
- Issue:
asChildprop doesn't exist on DropdownMenu.Item in bits-ui - Fix: Use
childsnippet pattern instead ofasChildprop
Lower Priority
9. maxLength vs maxlength (4 errors)
- Issue: HTML attribute should be lowercase
maxlength - Fix: Change
maxLengthtomaxlengthin input elements
10. Button Variant "outlined" (3 errors)
- Issue: "outlined" is not a valid Button variant
- Fix: Use correct variant name (check Button component for valid variants)
11. SearchResult Type Mismatch (5 errors)
- Issue:
SearchResult<any>[]vsSearchResult[]type mismatch - Fix: Update function signatures to use consistent SearchResult type
Files Modified in This Session
src/lib/api/adapters/types.ts- RequestOptions cache fixsrc/lib/api/adapters/base.adapter.ts- cacheTime usagesrc/lib/api/adapters/entity.adapter.ts- Character type propertiessrc/lib/api/adapters/index.ts- New file for exportssrc/lib/api/resources/users.ts- Updated to use userAdaptersrc/lib/types/declarations.d.ts- wx-svelte-grid and $env type shimssrc/lib/types/api/entities.ts- Character type propertiessrc/lib/components/UserSettingsModal.svelte- Multiple fixessrc/lib/components/panels/SearchSidebar.svelte- Accepted upstream versionsrc/lib/components/party/Party.svelte- granblueId fixsrc/routes/teams/new/+page.svelte- Accepted upstream version
Commands to Verify Progress
# Count remaining errors
pnpm check 2>&1 | grep -c "Error:"
# Analyze error patterns
pnpm check 2>&1 | grep "Error:" | sort | uniq -c | sort -rn | head -20
# Run lint
pnpm lint
# Run build
pnpm build
Next Steps
- Fix the 'firstItem'/'item' possibly undefined errors in teams/new/+page.svelte
- Add missing Paraglide translation keys
- Update PartyCtx type to include openPicker
- Update Summon type in entity.adapter.ts to include hp/atk
- Fix exactOptionalPropertyTypes violations
- Fix bits-ui component usage (Select.ItemIndicator, DropdownItem asChild)
- Run
pnpm checkto verify all errors are resolved - Run
pnpm lintandpnpm build - Create PR with all fixes