Skip to content

Fix Type Redeclaration Errors #237

@DrunkOnJava

Description

@DrunkOnJava

Issue Description

Multiple types are declared in multiple files, causing "Invalid redeclaration" compilation errors. This creates ambiguity for the Swift compiler.

Affected Types and Files

Infrastructure-Network Module

  • APIConfiguration: Declared in both API/APIModels.swift and Configuration/APIConfiguration.swift
  • NetworkError: Declared in both Models/NetworkModels.swift and Errors/NetworkError.swift
  • HTTPMethod: Declared in both Models/NetworkModels.swift and Protocols/APIEndpoint.swift
  • APIEndpoint: Declared in both Protocols/APIEndpoint.swift and API/APIModels.swift
  • RetryPolicy: Declared in both Configuration/APIConfiguration.swift and Models/NetworkModels.swift
  • AuthenticationProvider: Declared in both Protocols/APIEndpoint.swift and Protocols/NetworkProtocols.swift

Infrastructure-Storage Module

  • StorageConfiguration: Declared in both Configuration/StorageConfiguration.swift and Protocols/StorageProtocols.swift
  • RepositoryError: Declared in both Repositories/DefaultCollectionRepository.swift and Repositories/Insurance/DefaultInsurancePolicyRepository.swift

UI-Components Module

  • EnhancedSearchBar properties: searchText, isVoiceSearchActive, showFilters declared multiple times within the same struct

Root Cause

  1. Types were accidentally defined in multiple files during refactoring
  2. Inconsistent organization of types across modules
  3. Missing centralized type definitions

Solution Plan

  1. Choose canonical locations for each type:

    • APIConfigurationInfrastructure-Network/Configuration/APIConfiguration.swift
    • NetworkErrorInfrastructure-Network/Errors/NetworkError.swift
    • HTTPMethodInfrastructure-Network/Models/NetworkModels.swift
    • APIEndpointInfrastructure-Network/Protocols/APIEndpoint.swift (as protocol)
    • RetryPolicyInfrastructure-Network/Configuration/APIConfiguration.swift
    • AuthenticationProviderInfrastructure-Network/Protocols/NetworkProtocols.swift (as protocol)
    • StorageConfigurationInfrastructure-Storage/Configuration/StorageConfiguration.swift
    • RepositoryErrorInfrastructure-Storage/Errors/RepositoryError.swift (new centralized location)
  2. Remove duplicate definitions from non-canonical locations

  3. Update imports in files that reference these types

  4. Ensure proper access control (public/internal) for shared types

Priority

High - These errors prevent successful compilation after import issues are resolved.

Acceptance Criteria

  • All "Invalid redeclaration" errors are resolved
  • Each type has a single, canonical definition
  • All references to types use proper imports
  • Module builds successfully without redeclaration errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions