Skip to content

Replace untyped projectedFlowData with explicit typed variables in MonthlyFlow.vue#130

Closed
Copilot wants to merge 2 commits intomid_extreme_chartsfrom
copilot/sub-pr-124
Closed

Replace untyped projectedFlowData with explicit typed variables in MonthlyFlow.vue#130
Copilot wants to merge 2 commits intomid_extreme_chartsfrom
copilot/sub-pr-124

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

projectedFlowData was inferred as any due to being initialized as [] in one branch and an object in another, making API shape mismatches invisible to the compiler.

Changes

  • Split into two explicitly typed const variables, each scoped to its context:
    • projectedFlowDataMid: number[]
    • projectedFlowDataExtremes: Record<string, number[]>
  • Ternary initialization replaces the mutable let + imperative if/else — both fall back to an empty value when not in the matching context and are only accessed within their respective branch
const projectedFlowDataMid: number[] =
  appContext.value === 'mid'
    ? Object.keys(monthLabels).map(
        monthKey => props.streamMonthlyFlow['projected'][appContext.value][monthKey]
      )
    : []

const projectedFlowDataExtremes: Record<string, number[]> =
  appContext.value === 'extremes'
    ? props.streamMonthlyFlow['projected'][appContext.value]
    : {}

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] [WIP] Address feedback on hydrograph and monthly flow charts PR Replace untyped projectedFlowData with explicit typed variables in MonthlyFlow.vue Mar 26, 2026
Copilot AI requested a review from cstephen March 26, 2026 00:02
@cstephen
Copy link
Copy Markdown
Contributor

Closing this without merging. It fixed the type of projectedFlowData but made the code harder to read in the process. Fixed in 7eb6ad6 instead.

@cstephen cstephen closed this Mar 26, 2026
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.

2 participants