Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error TS2567 when using this plugin in version 2.1.2 #854

Closed
yKicchan opened this issue Feb 17, 2023 · 17 comments · Fixed by #877
Closed

Error TS2567 when using this plugin in version 2.1.2 #854

yKicchan opened this issue Feb 17, 2023 · 17 comments · Fixed by #877
Labels

Comments

@yKicchan
Copy link

When I install this plugin and import it I get an error:

Error: node_modules/chartjs-plugin-annotation/types/index.d.ts:6:13 - error TS2428: All declarations of 'PluginOptionsByType' must have identical type parameters.

6   interface PluginOptionsByType<TType extends ChartType> {
              ~~~~~~~~~~~~~~~~~~~

I am using chartjs 4.2.1.
When using version 2.0.1 of this plugin everything works. However I dont think thats a proper solution.

@navelya
Copy link

navelya commented Feb 20, 2023

Same here with new version I get this error

@stockiNail
Copy link
Collaborator

As workaround, you could set skipLibCheck: true to your tsconfig.

@yKicchan
Copy link
Author

Yes, I have already solved this problem using skipLibCheck, but I don't think that is a good way either!

@stockiNail
Copy link
Collaborator

@yKicchan let me ask you a couple of things:

  1. can you test your app with version 4.2.0 of CHART.JS? I have the feeling it sounds related to something in CHART.JS because I have seen other issues (the same here) on other plugins (datalabels, zoom).
  2. can you provide us a sample in order to reproduce the issue or provide the environment versions (frameworks you are using, versions)?

@LeeLenaleee @kurkle any thought? You know, my knowledge on TS is not so good...

@navelya
Copy link

navelya commented Feb 23, 2023

@stockiNail I'm using chart.js 4.2.0 and the the latest version of this plugin and it is not working,
I have tried to install an older version of this package (even though that's not a good idea ) and it wont install because it says it is not compatible with the cahrt.js newer version

@stockiNail
Copy link
Collaborator

@stockiNail I'm using chart.js 4.2.0 and the the latest version of this plugin and it is not working,
I have tried to install an older version of this package (even though that's not a good idea ) and it wont install because it says it is not compatible with the cahrt.js newer version

Thank you @navelya . I did some tests on different TS versions, using chart.js 4.2.1 and the last version of plugin 2.1.2 but I wasn't able to reproduce the issue. Can you provide me more info about your environment in order to try to reproduce the issue?

@navelya
Copy link

navelya commented Feb 27, 2023

@stockiNail I'm using chart.js 4.2.0 and the the latest version of this plugin and it is not working,
I have tried to install an older version of this package (even though that's not a good idea ) and it wont install because it says it is not compatible with the cahrt.js newer version

Thank you @navelya . I did some tests on different TS versions, using chart.js 4.2.1 and the last version of plugin 2.1.2 but I wasn't able to reproduce the issue. Can you provide me more info about your environment in order to try to reproduce the issue?

Im using angular in my project and also another chart.js plugin, if it working on chart.js 4.2.1 perhaps its chart.js problem even though a diffrent plugins are working, I can't use chartmjs 4.2.1 in my project because it is not up to me so the entire project is on 4.2.0.

@stockiNail
Copy link
Collaborator

stockiNail commented Feb 28, 2023

@navelya I have created a sample app by Angular (15.2.0). I have added chartjs (4.2.1 and also with 4.2.0), plugin annotation (2.1.2) and datalabels (2.2.0) and it's working. The chart, annotations and labels are well rendered and no issue from TS (4.9.5). I'll take more time in the next days if I can reproduce the issue.

@tmarimut
Copy link

tmarimut commented Mar 3, 2023

Hi @stockiNail . I am able to reproduce the exact same issue with Chart.js v4.2.1. Please help address this issue.

@stockiNail
Copy link
Collaborator

Hi @stockiNail . I am able to reproduce the exact same issue with Chart.js v4.2.1. Please help address this issue.

Can you provide the reproducible sample?

@stockiNail
Copy link
Collaborator

@navelya @tmarimut after another check, our guess is that you, which experiencing this issue, have multiple versions of Chart.js in node_modules, so could you should check your lock files?

@navelya
Copy link

navelya commented Mar 6, 2023

@navelya @tmarimut after another check, our guess is that you, which experiencing this issue, have multiple versions of Chart.js in node_modules, so could you should check your lock files?

That's could be it, I will check it as fast as I can, thank u!

@KevinSafeguard
Copy link

@stockiNail Attached you find a reproducible sample. In this case its a combination of chart.js@4.2.1, chartjs-plugin-annotation@2.2.1 and chartjs-plugin-zoom@2.0.1 causing this issue.

chartjs-plugins-test.zip

@stockiNail
Copy link
Collaborator

@KevinSafeguard thank youuuu! very helpful! I think it's Chart.js issue and I raised it in chartjs slack dev channel. I'm thinking that because if you change the sequence of the "import"s for zoom and annotation plugins in your code (chart.component.ts file) then the error is occurring for zoom plugin instead of the annotation one.

@rfrancois
Copy link

rfrancois commented May 9, 2023

I saw the same bug today, but after re-install all packages, it worked.

@rfrancois
Copy link

Again the same problem this morning without reason. I did not understand how to fix it in #877
I have all these versions :
"chart.js": "^4.3.0",
"chartjs-adapter-moment": "^1.0.1",
"chartjs-plugin-annotation": "^2.2.1",
"chartjs-plugin-zoom": "^2.0.1",
Is the solution to downgrade ?

@stockiNail
Copy link
Collaborator

The fix has not been released yet. It will be with next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants