The plotLines property on XAxisProps and YAxisProps is typed as a single object, but Highcharts expects an array.
Current type in @highcharts/react:
// node_modules/@highcharts/react/options/XAxis.d.ts
plotLines?: {
acrossPanes?: boolean;
className?: string;
color?: Highcharts.ColorString;
dashStyle?: Highcharts.DashStyleValue;
// ...
};
Correct type from highcharts:
// node_modules/highcharts/highcharts.d.ts
plotLines?: Array<XAxisPlotLinesOptions>;
The Highcharts API documentation confirms plotLines is an array.
Runtime error:
When following the incorrect types and passing a single object, Highcharts throws:
(options.plotLines || []).concat is not a function
Highcharts internally expects an array and calls .concat() on it. A single object is truthy, so the || [] fallback doesn't apply, and .concat() fails.
Expected type:
plotLines?: Array<{
acrossPanes?: boolean;
className?: string;
color?: Highcharts.ColorString;
dashStyle?: Highcharts.DashStyleValue;
// ...
}>;
Versions:
@highcharts/react: 4.1.0
highcharts: 12.5.0
The
plotLinesproperty onXAxisPropsandYAxisPropsis typed as a single object, but Highcharts expects an array.Current type in
@highcharts/react:Correct type from
highcharts:The Highcharts API documentation confirms
plotLinesis an array.Runtime error:
When following the incorrect types and passing a single object, Highcharts throws:
Highcharts internally expects an array and calls
.concat()on it. A single object is truthy, so the|| []fallback doesn't apply, and.concat()fails.Expected type:
Versions:
@highcharts/react: 4.1.0highcharts: 12.5.0