GSA / GSA/sam-ui-elements

Replace unsafe/legacy types in ui-kit/form-controls autocomplete family

Open
#728 0 comments 0 reactions 0 assignees View on GitHub
maintenance tech-debt
Dominant language
TypeScript
Stars
8
Forks
33
Avg merge
2d 51m
Merged PRs (30d)
65

Description

## Parent

GSA/sam-ui-elements#586

## What to build

Replace unsafe/legacy TypeScript types (`any`, unsafe function types, wrapper-object types) across the autocomplete component family in `src/ui-kit/form-controls` (~99 ESLint findings), split out of GSA/sam-ui-elements#706 to keep that PR reviewable.

Scope:
- `autocomplete/autocomplete.component.ts` (27)
- `autocomplete/autocomplete.service.ts` (2)
- `autocomplete/autocomplete.spec.ts` (4)
- `autocomplete-multiselect/autocomplete-multiselect.component.ts` (23)
- `autocomplete-multiselect/autocomplete-cache.ts` (17)
- `sam-sds-autocomplete/autocomplete-search/autocomplete-search.component.ts` (8)
- `sam-sds-autocomplete/autocomplete-search/autocomplete-search.component.spec.ts` (4)
- `sam-sds-autocomplete/autocomplete-search/autocomplete-seach-test-service.spec.ts` (1)
- `sam-sds-autocomplete/autocomplete/autocomplete.component.ts` (6)
- `sam-sds-autocomplete/selected-result/selected-result.component.ts` (6)
- `sam-sds-autocomplete/selected-result/models/sds-selected-item-model-helper.ts` (1)

Inventory the current findings first (`npx eslint src/ui-kit/form-controls/autocomplete src/ui-kit/form-controls/autocomplete-multiselect src/ui-kit/form-controls/sam-sds-autocomplete`), then replace each `any`/unsafe-function-type usage with a precise type or a justified, narrowly-scoped alternative, following the same approach used in GSA/sam-ui-elements#702 and GSA/sam-ui-elements#706.

These components share generic result-type/cache/callback plumbing (the multiselect's cache and the SDS autocomplete's search/selected-result pieces depend on the same result-item shapes), so reviewing them together as one cohesive family makes more sense than splitting further.

## Acceptance criteria

- [ ] Unsafe-type findings in the autocomplete component family (`autocomplete/`, `autocomplete-multiselect/`, `sam-sds-autocomplete/`) are inventoried before implementation
- [ ] `any` usages in this family are replaced with precise types or justified, narrowly scoped alternatives
- [ ] Any wrapper-object or unsafe function types in this family are replaced with safe equivalents
- [ ] Public API and consumer-compiled source compatibility are preserved (no breaking signature changes)
- [ ] Relevant component tests and the full test-app suite remain green
- [ ] The root ESLint warning baseline (`eslint-baseline.json`) is lowered to reflect the resolved findings

## Blocked by

None - can start immediately (independent of #706's remaining scope, split for reviewability rather than dependency)

Contributor guide

Open the contributing guide

Research direction

Run the scoped ESLint command first and inventory findings across src/ui-kit/form-controls/autocomplete, autocomplete-multiselect, and sam-sds-autocomplete, then review the related component, service, cache, model-helper, and spec files listed in the issue. Follow the type-safe patterns from GSA/sam-ui-elements#702 and #706; done means the findings are resolved without public API changes, relevant and full test-app suites pass, and eslint-baseline.json is lowered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, testing, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.