Skip to content

fix(frontend): replace Findings API response any with typed contract#1988

Open
SathvikaSingoti wants to merge 1 commit into
utksh1:mainfrom
SathvikaSingoti:fix/findings-response-type-1401
Open

fix(frontend): replace Findings API response any with typed contract#1988
SathvikaSingoti wants to merge 1 commit into
utksh1:mainfrom
SathvikaSingoti:fix/findings-response-type-1401

Conversation

@SathvikaSingoti

Copy link
Copy Markdown
Contributor

Description

The Findings page cast the getFindings API response to any in its initial fetch and loadMore callbacks, which hid pagination/result shape mistakes from the type checker. getFindings already returns a typed FindingsResponse (with findings?: FindingRecord[]) in api.ts, so this PR traces that type through the Findings page instead of discarding it.

Related Issues

Closes #1401

Type of Change

  • Refactor / type safety (non-breaking, no behavior change)

How Has This Been Tested?

  • Replaced (data: any) with (data: FindingsResponse) in the initial fetch effect and removed the any-adjacent as Finding[] blind cast in loadMore.
  • FindingRecord.id is string | undefined (shared type used across many endpoints), while the page's local Finding type requires id: string. Rather than weakening either type, both fetch paths now filter out any finding missing a valid id before assigning state, since a finding without an id can't be selected, checked, or reviewed anyway. This is stricter/safer than the previous blind cast.
  • Ran npm run typecheck - passes with no errors.
  • Ran npm run test - 537/537 tests passing across 61 files.
  • Ran npm run build - builds clean.
  • Ran bash scripts/check-artifacts.sh origin/main - no tracked generated artifacts or cache files in the diff.

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.
  • 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 Findings API response any with a typed response contract

1 participant