Skip to content

Problems with TypeScript and Rollup #9675

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

Closed
JapuDCret opened this issue Sep 24, 2021 · 2 comments
Closed

Problems with TypeScript and Rollup #9675

JapuDCret opened this issue Sep 24, 2021 · 2 comments

Comments

@JapuDCret
Copy link

JapuDCret commented Sep 24, 2021

We are trying to use Chart.js in our project, which uses mostly plain js (with TypeScript).
We downgraded TypeScript to 4.3 to mitigate #9666.

We are using rollup as a bundler and followed the hint here: https://www.chartjs.org/docs/latest/getting-started/integration.html#bundlers-webpack-rollup-etc

But it seems that there are no matching type declarations for these helper functions

error TS2307: Cannot find module 'chart.js/auto' or its corresponding type declarations.

this is basically our code:

import Chart from 'chart.js/auto';

let barchartCanvas = document.getElementById('barchart')! as HTMLCanvasElement;
let ctx = barchartCanvas .getContext('2d')!;
let myChart = new Chart(ctx, {
  type: 'bar',
  data: {
    // ...
  },
});

Are we doing something wrong?

@etimberg etimberg added the type: types Typescript type changes label Sep 24, 2021
@kurkle
Copy link
Member

kurkle commented Sep 24, 2021

@etimberg
Copy link
Member

Closing as stale

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

No branches or pull requests

3 participants