Typescript 5.2.2 issue in VictoryLineBase
Describe the bug
Code in question:
<VictoryLine
data={Array.from(electricCostsByYear).map(([year, cost]) => ({
x: year,
y: cost,
}))}
style={{
data: {
stroke: CHART_COLORS[0],
strokeWidth: ({ active }) => (active ? 6 : 4),
strokeDasharray: "12",
},
labels: { fill: CHART_COLORS[0] },
}}
/>
Victory version Latest
Code Sandbox link
To Reproduce Steps to reproduce the behavior:
- Use Victory Line Chart with TS 5.2.2
Expected behavior No error like in previous version of TS
Screenshots Above
@wadehammes Seeing the same issue after bumping TypeScript to 5.2.2 in a Next.js project.
Not ideal, but for anyone hitting the same issue and needs a quick fix... explicitly declaring active as an optional boolean worked for me.
strokeWidth: ({ active }: { active?: boolean }) => (active ? 6 : 4)
@wadehammes Seeing the same issue after bumping TypeScript to 5.2.2 in a Next.js project.
Not ideal, but for anyone hitting the same issue and needs a quick fix... explicitly declaring active as an optional boolean worked for me.
strokeWidth: ({ active }: { active?: boolean }) => (active ? 6 : 4)
This worked for me. Thanks!
We are working on updating all components to full TS and getting on the latest version. Will revisit this when Victory is on TS 5.x