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.

Compilation error TS1122 in apexcharts.d.ts

See original GitHub issue

Issue

I can’t import apexcharts on my angular 5.2 project

Explanation

After doing npm install apexcharts --save

When i tried to import the module import {ApexCharts} from 'apexcharts'

I’ve got an error :

TS2305: Module ‘“apexcharts”’ has no exported member ‘ApexCharts’.

apexchart_error_exported_member

So i tried to import all the module import * as ApexCharts from 'apexcharts'

But now, i’ve another error because the apexcharts.d.ts contains an error, it is not compiling.

ERROR in node_modules/apexcharts/apexcharts.d.ts(526,16): error TS1122: A tuple type element list cannot be empty.

apexchart_error

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
junedchhipacommented, Feb 8, 2019

@sugihartolim ApexCharts is also exported as commonjs in the dist directory.

Can you please try

import ApexCharts from 'apexcharts/dist/apexcharts.common.js'
4reactions
sugihartolimcommented, Feb 7, 2019

Thank you @ivelfan & @junedchhipa , that’s the final piece that finally made it work. As of angular 7 and apexcharts 3.2.2, to recap just in case anyone else needs it: (Note that ‘module: es2015’ WILL NOT work)

tsconfig.json: "compilerOptions" : { "module": "commonjs", "target": "es5", "esModuleInterop": true, "allowSyntheticDefaultImports": true }

// @ts-ignore 'import ApexCharts from ‘apexcharts’; ’

This is a temporary workaround until the export situation got resolved, i guess.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Module not found: Can't resolve 'apexcharts/dist ...
Failed to compile ./node_modules/react-apexcharts/dist/react-apexcharts.min.js Module not found: Can't resolve ...
Read more >
Angular Pie Chart Basic Example - ApexCharts.js
Team D. Team E. 24.9% 31.1% 7.3% 24.3% 12.4% ... main.ts. polyfills.ts. styles.css. typings.d.ts .angular-cli.json. package.json ... @angular/compiler8.2.14.
Read more >
How to create Angular charts using ApexCharts
Create Angular Charts using an ng-apexcharts component. Build beautiful and interactive visualizations in your Angular applications.
Read more >
Series [Working with Data] - ApexCharts.js
Know which formats are supported by ApexCharts to parse your data correctly whether it be timeline or categorized data for building interactive charts....
Read more >
A Vue Chart wrapper for ApexCharts.js
Create Vue Charts using Vue-ApexCharts. Build interactive visualizations in your vue 2.0 and vue 3.0 apps. Works in both Vue 2 and Vue...
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