Skip to content

fix(types): replace any types with proper TypeScript interfaces in AIConfigPopup#823

Closed
Satvik77777 wants to merge 2 commits intoaccordproject:mainfrom
Satvik77777:fix/replace-any-types-aiconfigpopup
Closed

fix(types): replace any types with proper TypeScript interfaces in AIConfigPopup#823
Satvik77777 wants to merge 2 commits intoaccordproject:mainfrom
Satvik77777:fix/replace-any-types-aiconfigpopup

Conversation

@Satvik77777
Copy link
Copy Markdown
Contributor

Summary

Replaces all any type usages in AIConfigPopup.tsx with
proper TypeScript interfaces for better type safety.

Problem

AIConfigPopup.tsx had 7 instances of any type:

  • 6 instances in API response model mappings
  • 1 instance in catch block (err: any)

Using any defeats the purpose of TypeScript — it disables
type checking and hides potential bugs.

Solution

Added 4 proper TypeScript interfaces:

interface OpenAIModel { id: string; }

interface ProviderModel { id?: string; name?: string; model?: string; }

interface OpenAIModelsResponse { data?: OpenAIModel[]; }

interface ProviderModelsResponse { models?: ProviderModel[]; }

Also:

  • Replaced catch (err: any) with catch (err: unknown)
    and added proper instanceof Error check
  • Replaced repeated localStorage.removeItem() calls
    with array loop in handleReset

Files Changed

  • src/components/AIConfigPopup.tsx

Testing

  • All 75 unit tests pass
  • No functional changes

Screenshots or Video

No UI changes — type safety improvement only.

Related Issues

  • Improves TypeScript strictness across the codebase

Author Checklist

  • Ensure you provide a DCO sign-off
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

…ConfigPopup

Signed-off-by: Satvik <satviksaini02@gmail.com>
@Satvik77777 Satvik77777 requested a review from a team as a code owner March 15, 2026 12:47
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 15, 2026

Deploy Preview for ap-template-playground failed.

Name Link
🔨 Latest commit 30546d9
🔍 Latest deploy log https://app.netlify.com/projects/ap-template-playground/deploys/69b9dd0005ec9e0008455a6f

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Apr 2, 2026
@github-actions github-actions bot closed this Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant