[Chartjs]-Chartjs with Typescript: The types of 'interaction.mode' are incompatible between these types

2👍

When I change my options to

const options = {
    ...
    interaction: {
        ...
        mode: "index" as "index"
    },
    ...
}

it does work

0👍

You need to define type of options:

  import { ChartOptions } from 'chart.js';

  const options: ChartOptions = {
    interaction: {
      intersect: false,
      mode: 'index',
    },
  };

Leave a comment