Skip to content

Commit bf8f5d8

Browse files
xrendanclaude
andcommitted
πŸ”§πŸ€– Fix TypeScript type errors across packages
- Fix TagGraphRoot type conflict by changing from intersection to interface - Fix EntitySelector regex match type inference - Fix GrapherState dimension type mismatch in lodash uniqWith - Fix Tabs/TabsWithDropdown ref types (HTMLButtonElement -> HTMLDivElement) - Fix LineChartHelpers/SlopeChartHelpers sortBy type inference - Fix ContentSwitchers ref type - Exclude test files and stories from tsconfig type checking - Add zod and instantsearch.js dependencies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 590b9de commit bf8f5d8

File tree

13 files changed

+101
-16
lines changed

13 files changed

+101
-16
lines changed

β€Žbun.lockβ€Ž

Lines changed: 86 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žpackage.jsonβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@
219219
"html-void-elements": "^3.0.0",
220220
"indefinite": "^2.5.2",
221221
"inline-style-parser": "^0.2.7",
222+
"instantsearch.js": "^4.86.1",
222223
"internmap": "^2.0.3",
223224
"intl-messageformat": "^11.1.0",
224225
"is-plain-obj": "^4.1.0",
@@ -323,6 +324,7 @@
323324
"vite": "^6.0.0",
324325
"vitest": "^4.0.17",
325326
"web-namespaces": "^2.0.1",
327+
"zod": "^4.3.5",
326328
"zwitch": "^2.0.4"
327329
}
328330
}

β€Žpackages/charts/src/grapher/controls/ContentSwitchers.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class ContentSwitchers extends React.Component<{
4242
}
4343

4444
private isOverflowMenuOpen = false
45-
private overflowButtonRef = React.createRef<HTMLButtonElement>()
45+
private overflowButtonRef = React.createRef<HTMLDivElement>()
4646

4747
@computed private get manager(): ContentSwitchersManager {
4848
return this.props.manager

β€Žpackages/charts/src/grapher/core/GrapherState.tsxβ€Ž

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,10 +1641,7 @@ export class GrapherState {
16411641
if (!slot.allowMultiple)
16421642
validDimensions = _.uniqWith(
16431643
validDimensions,
1644-
(
1645-
a: OwidChartDimensionInterface,
1646-
b: OwidChartDimensionInterface
1647-
) =>
1644+
(a, b) =>
16481645
a.property === slot.property &&
16491646
a.property === b.property
16501647
)

β€Žpackages/charts/src/grapher/entitySelector/EntitySelector.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ const EXTERNAL_SORT_INDICATOR_DEFINITIONS = [
205205
// then check the label
206206
const label = getTitleForSortColumnLabel(column)
207207
// matches "gdp per capita" and content within parentheses
208-
const potentialMatches =
208+
const potentialMatches: string[] =
209209
label.match(/\(.*?\)|(\bgdp per capita\b)/gi) ?? []
210210
// filter for "gdp per capita" matches that are not within parentheses
211211
const matches = potentialMatches.filter(

β€Žpackages/charts/src/grapher/lineCharts/LineChartHelpers.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export function toRenderLineChartSeries(
177177
// sort by interaction state so that foreground series
178178
// are drawn on top of background series
179179
if (isFocusModeActive || isHoverModeActive) {
180-
series = _.sortBy(series, byHoverThenFocusState)
180+
series = _.sortBy<RenderLineChartSeries>(series, byHoverThenFocusState)
181181
}
182182

183183
return series

β€Žpackages/charts/src/grapher/slopeCharts/SlopeChartHelpers.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function toRenderSlopeChartSeries(
6666
// Sort by interaction state so that foreground series
6767
// are drawn on top of background series
6868
if (isHoverModeActive || isFocusModeActive) {
69-
return _.sortBy(series, byHoverThenFocusState)
69+
return _.sortBy<RenderSlopeChartSeries>(series, byHoverThenFocusState)
7070
}
7171

7272
return series

β€Žpackages/charts/src/grapher/tabs/Tabs.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface TabItem<TabKey extends string = string> {
99
className?: string
1010
ariaLabel?: string
1111
dataTrackNote?: string
12-
ref?: React.RefObject<HTMLButtonElement | null>
12+
ref?: React.RefObject<HTMLDivElement | null>
1313
}
1414
}
1515

β€Žpackages/charts/src/types/domainTypes/ContentGraph.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface TagGraphNode {
4646
weight: number
4747
}
4848

49-
export type TagGraphRoot = TagGraphNode & {
49+
export interface TagGraphRoot {
5050
children: TagGraphNode[]
5151
id: number
5252
isTopic: false

β€Žpackages/charts/src/types/index.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export interface TagGraphNode {
300300

301301
export const TagGraphRootName = "tag-graph-root" as const
302302

303-
export type TagGraphRoot = TagGraphNode & {
303+
export interface TagGraphRoot {
304304
children: TagGraphNode[]
305305
id: number
306306
isTopic: false

0 commit comments

Comments
Β (0)