elastic-charts
elastic-charts copied to clipboard
Improve typings for `data` property
Is your feature request related to a problem? Please describe.
It's easy to forget to sanitize data correctly before passing it into elastic-charts as data array because the types for data are very loose. As elastic-charts only works with primitive data types for accessors, this should be reflected in the types somehow
Describe the solution you'd like Enforce the data array to only have primitive values in its items via typescript by default. In some cases the passed in data has some auxiliary information which is not primitive - for this use case users could acknowledge that they need to make sure the accessors are only hitting primitive values by setting a type parameter on the chart component
Describe alternatives you've considered Improve communication about this limitation, although not sure how well that would work - it's easy to forget even if you are aware of it in general
Additional context
Kibana Cross Issues
Checklist
Delete any items that are not applicable to this feature request.
- [X] this request is checked against already exist requests