Skip to content

refactor(frontend): replace TaskDetails result record any types with typed models-#1402#1989

Open
Rakshak05 wants to merge 1 commit into
utksh1:mainfrom
Rakshak05:issue-#1402
Open

refactor(frontend): replace TaskDetails result record any types with typed models-#1402#1989
Rakshak05 wants to merge 1 commit into
utksh1:mainfrom
Rakshak05:issue-#1402

Conversation

@Rakshak05

Copy link
Copy Markdown
Contributor

Description

This PR replaces broad Record<string, any>, any[], and dynamic any index signatures with explicit interfaces or unknown-safe record types in the TaskDetails component.

Specifically, it implements the following modifications in TaskDetails.tsx:

  • Replaced inputs?: Record<string, any> with Record<string, unknown> in the Task interface.
  • Replaced metadata?: Record<string, any> with Record<string, unknown> in the Finding interface.
  • Imported and utilized EvidenceRecord and AssetServiceRecord from ../api for the evidence field in Finding and the services field in AssetSummaryEntry respectively.
  • Replaced references?: Array<Record<string, any>> with Array<Record<string, unknown>> in the Finding interface.
  • Explicitly typed the structured results object structure in TaskResult to define findings?: Finding[] and total_count?: number alongside rows?: Array<Record<string, unknown>>.
  • Replaced the row: any mapper typing with row: Record<string, unknown> in the tableRows rendering paths.

Related Issues

Closes #1402

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

We verified these changes locally using TypeScript typechecking to ensure zero compiler issues are introduced:

  1. Ran npm run typecheck inside frontend/ directory, which successfully completed compilation with zero errors.

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

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.

[TYPESCRIPT] Replace TaskDetails result record any types with typed result models

1 participant