Skip to content

Conversation

@zanesq
Copy link
Collaborator

@zanesq zanesq commented May 28, 2025

  • Fix AlertBox.tsx: Add non-null assertions for alert.progress properties (safe because already guarded by alert.progress ? check)

  • Fix ConfigContext.tsx: Add optional chaining for API response data access

    • response.data?.config, configResponse.data?.config
    • extensionsResponse.data?.extensions with fallback to empty array
  • Fix App.tsx: Correct extractRemoteUrl return type to string | null (URLSearchParams.get() returns string | null, not string)

  • Fix SearchBar.tsx: Improve null checks for localSearchResults access

    • Better conditional logic to handle undefined count property
  • Bonus: Comprehensive asset type declarations in json.d.ts

    • Added PNG, JPG, GIF, SVG, MP3, MP4 module declarations
    • Fixes all asset import TypeScript errors
  • Reduces TypeScript errors by 11 (from 361 to 350)

  • Uses proper TypeScript patterns: optional chaining (?.) and non-null assertions (!)

  • All changes are conservative and preserve existing runtime behavior

- Fix AlertBox.tsx: Add non-null assertions for alert.progress properties
  (safe because already guarded by alert.progress ? check)

- Fix ConfigContext.tsx: Add optional chaining for API response data access
  - response.data?.config, configResponse.data?.config
  - extensionsResponse.data?.extensions with fallback to empty array

- Fix App.tsx: Correct extractRemoteUrl return type to string | null
  (URLSearchParams.get() returns string | null, not string)

- Fix SearchBar.tsx: Improve null checks for localSearchResults access
  - Better conditional logic to handle undefined count property

- Bonus: Comprehensive asset type declarations in json.d.ts
  - Added PNG, JPG, GIF, SVG, MP3, MP4 module declarations
  - Fixes all asset import TypeScript errors

- Reduces TypeScript errors by 11 (from 361 to 350)
- Uses proper TypeScript patterns: optional chaining (?.) and non-null assertions (!)
- All changes are conservative and preserve existing runtime behavior
@zanesq zanesq requested a review from alexhancock May 28, 2025 22:28
@zanesq zanesq merged commit df75074 into fix/typescript-errors-phase2-unused-variables May 29, 2025
1 check passed
@zanesq zanesq deleted the fix/typescript-errors-phase3-null-checks branch May 29, 2025 15:26
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.

3 participants