[LANDGRIF-1685] updates typing of legend values and map data #1251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
General description
https://vizzuality.atlassian.net/browse/LANDGRIF-1685
This pull request focuses on improving type safety and simplifying code in the
analysis-map
andh3-data
modules. The changes primarily involve refining type definitions, removing unnecessary type assertions, and streamlining function implementations.Type Safety Improvements:
scaleByLegendType
inclient/src/hooks/h3-data/utils.ts
to use more precise type definitions forthreshold
andrangeValues
, replacing genericnumber[]
andstring[]
with inferred types based onLegend['items']
. This eliminates the need for type assertions.Code Simplifications:
getLegendScale
function inclient/src/containers/analysis-visualization/analysis-map/component.tsx
by directly returning the result ofscaleByLegendType
instead of assigning it to a variable first.responseContextualParser
function inclient/src/hooks/h3-data/contextual.ts
by removing redundant type annotations and formatting thedata.map
callback for clarity.Cleanup:
UseQueryResult
) and the associatedH3DataResponse
type inclient/src/hooks/h3-data/utils.ts
, as they were no longer utilized in the codebase. [1] [2]Designs
Link to the related design prototypes (if applicable)
Testing instructions
Provide minimal instructions on how to test this PR.
Checklist before merging