victory
victory copied to clipboard
Data Accessors using a function gives Typescript compiling errors
Bug Reports
Checklist
-
[x] I am using the latest version of Victory
-
[x] I've searched open issues to make sure I'm not opening a duplicate issue
The Problem
Since version 3.5.* using the Data Accessors on either bar or line using a function gives Typescript compiling errors. It think the following commit caused the issue: https://github.com/FormidableLabs/victory/commit/43baeadb734bcb6c03e9abb4806fbe625f49ea4e#diff-066d807c91e06b799cde9263f3800161e2382910e1f5e259fd8c8a35eab1ba63R14
Changing object to any would fix the error, although you probably want to avoid any.
Reproduction
Sandbox https://codesandbox.io/s/victory-brush-zoom-chart-forked-ucmswz?file=/src/components/Chart.tsx
I think, at this point, using any
is the best bet.
We don't (yet) support generics on our components (eg. where we could infer the data
type and use that for the datum
parameter).
And we don't know anything about the shape of datum
.
So it makes sense to type as any
, which would also allow the consumer to explicitly specify their own type.
Published as 36.6.4
! Thanks for reporting!