Adopt typedEntries helper across existing Object.entries() call sites
- Dominant language
- TypeScript
- Stars
- 481
- Forks
- 108
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 5
Description
The `styles-import-export` branch introduced `typedEntries` (`packages/graph-explorer/src/utils/typedEntries.ts`), a thin wrapper over `Object.entries` that preserves the key type (`keyof T`) instead of widening it to `string`. It currently has a single consumer (`stylingParser.ts`'s `toStyleMap`).
Sweep the remaining `Object.entries()` call sites in `packages/graph-explorer/src` and adopt `typedEntries` where the key type is known and sound — i.e. the object has no keys beyond `keyof T` (controlled boundaries, not values that may carry unknown keys, per the helper's own caveat).
~12 non-test call sites to review (test helpers and the helper's own file excluded):
- `components/RouteButton.tsx`
- `components/Tabular/controls/ExportControl/ExternalExportControl.tsx`
- `connector/openCypher/mappers/mapApiProperties.ts`
- `connector/openCypher/mappers/mapResults.ts`
- `connector/sparql/fetchSchema/index.ts`
- `connector/sparql/rawquery.ts`
- `core/StateProvider/displayAttribute.ts`
- `core/StateProvider/localDb.ts`
- `core/StateProvider/schema.ts`
- `core/StateProvider/serializeData.ts`
- `modules/Namespaces/CommonPrefixes.tsx`
- `utils/rdf/commonPrefixes.ts`
Each adoption is a case-by-case judgment: apply where it removes a downstream `as`/cast or a widened key; skip where the object genuinely carries unknown keys (the cast would be unsound there).
> [!IMPORTANT]
> Internal only — this issue is maintained by the core team and is not accepting external contributions.
Contributor guide
Research direction
Start with packages/graph-explorer/src/utils/typedEntries.ts and its use in stylingParser.ts, then review the listed Object.entries() sites in RouteButton, Tabular/controls/ExportControl, connector/openCypher, connector/sparql, core/StateProvider, modules/Namespaces, and utils/rdf. Done means adopting typedEntries only where the key type is sound, removing applicable casts or widening, and leaving unknown-key cases unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- developer-experience, frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100