question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript error: import {Chart} from 'react-chartjs-2'

See original GitHub issue

Hi, I have got a working bar chart but now I would like to register a plugin using Chart.pluginService.register(). As a first step, the readme file told me to do the following import: import { Chart } from 'react-chartjs-2';

But when I try to start my application I get the following Typescript error:

error TS2305: Module (…) has no exported member ‘Chart’.

Am I missing something? Any help will be much appreciated!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

13reactions
lee1994522commented, Dec 1, 2017

@thr0n Thanks for reply.At last I use const Chart = require('react-chartjs-2').Chart; to deal with it

6reactions
datenreisendercommented, Sep 16, 2020

Since Chart is really just passed through from chart.js, I solved the same problem for me by replacing

import { Chart } from 'react-chartjs-2';

with

import { Chart } from 'chart.js';

in my code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript error: import {Chart} from 'react-chartjs-2' · Issue #131
Hi, I have got a working bar chart but now I would like to register a plugin using Chart. ... Typescript error: import...
Read more >
react-chart-js-2 in combination with TypeScript for LineCharts ...
I am currently trying to build a LineChart via react-chartjs-2. To do that I am using TypeScript ...
Read more >
How to use react-chartjs-2 with TypeScript?
But occasionally types need to be set explicitly. They can be imported from Chart.js : import type { ChartData, ChartOptions } from 'chart.js';...
Read more >
react-chartjs-2 - npm
Start using react-chartjs-2 in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
Read more >
Chart.js
Chart.js provides a set of frequently used chart types, plugins, and customization options. In addition to a reasonable set of built-in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found