[Chartjs]-Type error when config ChartJs in Typescript

1👍

The Chart constructor expects a valid config (of type ChartConfiguration).

Use this type and try to meet the conditions (TypeScript will know the config type is a union).

import { ChartConfiguration } from "chart.js";

const config: ChartConfiguration = {
  type: 'line',
  data: datasets,
  options: { }
}

Leave a comment