chartjs / chartjs-adapter-date-fns

date-fns adapter for Chart.js
MIT License
100 stars 35 forks source link

Importing adapter to typescript file #40

Closed vaibhav135 closed 2 years ago

vaibhav135 commented 2 years ago

Hii, I recently tried to install chartjs-adapter-date-fns using npm install date-fns chartjs-adapter-date-fns --save. But I am using React with typecript and it is giving me following error "Could not find declaration file for module". I tried to install the module with @types/ but the type version of the adapter is not available. Question: How do add this adapter to my .tsx file?

SSylvain1989 commented 2 years ago

Hello , did you find a solution ? Same problem with react here ( nextJs ) no TypeScript . Thanks @vaibhav135

vaibhav135 commented 2 years ago

@SSylvain1989 I think I didn't use it in the end, BTW if I may ask what kind of problem are you trying to solve.

SSylvain1989 commented 2 years ago

Solve the problem by my self after all , i have ignored the warning , it work fine for me on chartjs 3.4.0

exemple below . Thanks

// import { Chart } from 'chart.js';
import 'chartjs-adapter-date-fns';
import { Line, defaults } from 'react-chartjs-2';

    scales: {
      x: {
        type: 'time',
        time: {
          displayFormats: {
            quarter: 'MMM YYYY',
          },
        },