1๐
โ
As described in the docs here you can pass your own custom datatype:
import {ChartData} from 'chart.js';
const datasets: ChartData<'bar', {key: string, value: number} []> = {
datasets: [{
data: [{key: 'Sales', value: 20}, {key: 'Revenue', value: 10}],
parsing: {
xAxisKey: 'key',
yAxisKey: 'value'
}
}],
};
Source:stackexchange.com