Skip to content

Fix TypeScript compilation errors across codebase #75

@remyluslosius

Description

@remyluslosius

Background

TypeScript compilation is currently failing in CI with approximately 20+ errors across multiple files. These are pre-existing issues that accumulated over time and are now blocking CI pipeline success.

Current Impact

  • ❌ Frontend CI failing
  • ❌ TypeScript Code Quality checks failing
  • ⚠️ Development experience degraded (type safety not working)
  • ✅ Application still functions correctly (runtime not affected)

Issues Identified

1. Missing Redux Actions

Files affected: RulesExplorer.tsx

error TS2304: Cannot find name 'fetchRules'
error TS2304: Cannot find name 'fetchRuleDetails'
error TS2304: Cannot find name 'fetchRuleDependencies'
error TS2304: Cannot find name 'exportRules'

Root Cause: Redux slice actions not properly imported or defined

2. SearchRequest Interface Incomplete

Files affected: ruleService.ts

error TS2339: Property 'platform' does not exist on type 'SearchRequest'
error TS2339: Property 'severity' does not exist on type 'SearchRequest'
error TS2339: Property 'category' does not exist on type 'SearchRequest'
error TS2339: Property 'framework' does not exist on type 'SearchRequest'

Root Cause: SearchRequest interface definition missing filter properties

3. Type Mismatches in Components

Files affected: ScanProgressDialog.tsx, AddHost.tsx, RulesExplorer.tsx

error TS7009: 'new' expression, whose target lacks a construct signature
error TS2322: Type incompatibility between component props
error TS2345: Argument type mismatch

Root Cause: Component props and state types not properly aligned

4. Auth Headers Type Issue

Files affected: useAuthHeaders.ts

error TS2411: Property 'Authorization' of type 'string | undefined' is not assignable to 'string' index type

Root Cause: Optional Authorization header not handled correctly in type definition

Recommended Fix Approach

Phase 1: Critical Types (Priority: High)

  1. Fix Redux action imports in RulesExplorer
  2. Complete SearchRequest interface definition
  3. Fix useAuthHeaders type safety

Estimated Effort: 2-3 hours

Phase 2: Component Type Fixes (Priority: Medium)

  1. Fix ScanProgressDialog constructor types
  2. Fix AddHost RadioGroup props
  3. Fix RulesExplorer action button types

Estimated Effort: 3-4 hours

Phase 3: Comprehensive Type Safety (Priority: Low)

  1. Enable strict TypeScript mode
  2. Add missing type definitions
  3. Fix all remaining type errors

Estimated Effort: 1-2 days

Files Requiring Attention

  • frontend/src/components/rules/RulesExplorer.tsx
  • frontend/src/services/ruleService.ts
  • frontend/src/hooks/useAuthHeaders.ts
  • frontend/src/components/host-groups/ScanProgressDialog.tsx
  • frontend/src/pages/hosts/AddHost.tsx

Success Criteria

  • All TypeScript compilation errors resolved
  • npx tsc --noEmit passes with 0 errors
  • Frontend CI pipeline passing
  • TypeScript Code Quality checks passing
  • No new type errors introduced

Related

Priority

Medium - Doesn't block current functionality but degrades code quality and CI reliability.


Created as follow-up to PR #74 merge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions