chartjs-plugin-crosshair icon indicating copy to clipboard operation
chartjs-plugin-crosshair copied to clipboard

Module '"chartjs-plugin-crosshair"' has no exported member 'CrosshairPlugin' and Interpolate

Open SharpieX opened this issue 2 years ago • 6 comments

Hi I am trying to use plugin with react-chartjs-2 in my typescript project and getting error in title

any solutions

SharpieX avatar Aug 24 '22 06:08 SharpieX

The types are outdated. On the DefinitelyTyped repo they're for version 1.1.1 while this repo is on 1.2.0. You may either update the types on definitely typed types, or in a .d.ts file, add this:

declare module 'chartjs-plugin-crosshair';

jayantbh avatar Sep 29 '22 16:09 jayantbh

The types are outdated. On the DefinitelyTyped repo they're for version 1.1.1 while this repo is on 1.2.0. You may either update the types on definitely typed types, or in a .d.ts file, add this:

declare module 'chartjs-plugin-crosshair';

Thank you very much, I had the same issue and your solution fixed it.

Daschi1 avatar Oct 11 '22 14:10 Daschi1

@Daschi1 @jayantbh could you please share exact changes i am still struglling , do i need to create a .d.ts file

SharpieX avatar Oct 11 '22 16:10 SharpieX

I used the plugin with the sveltjs wrapper of chartjs in a svelte typescript project. I copied declare module 'chartjs-plugin-crosshair'; in my vite-env.d.ts file, but any .d.ts should work.

Daschi1 avatar Oct 12 '22 13:10 Daschi1

Hey @SharpieX, ^ @Daschi1's instructions should work.

Basically create a file anywhere named anything.d.ts, just needs to be a .d.ts file and add it there. You could also add the declaration mentioned previously in any existing .d.ts file.

I personally have a directory/file like libdefs/ambient.d.ts in my project root where I add all such declarations.

jayantbh avatar Oct 23 '22 12:10 jayantbh

@jayantbh @SharpieX have you guys managed to make this plugin fly with react-chartjs-2? Could you pls share your packages versions? (react-chartjs-2, chartjs, chartjs-plugin-crosshair)

sarates avatar Jan 20 '23 07:01 sarates