Types: Exports and export assignments are not permitted in module augmentations.

See original GitHub issue

Been trying to install and use Apexcharts inside a Typescript project, but keep getting this weird error.

[ ERROR ]  TypeScript: node_modules/apexcharts/types/apexcharts.d.ts:956:1
           Exports and export assignments are not permitted in module augmentations.

    L955:  declare module 'apexcharts' {
    L956:  	export = ApexCharts;
    L957:  }

I was trying to fix this, and I found a way to get away from this error, I am just not sure if this is a right fix.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
niemyjskicommented, May 14, 2019

@junedchhipa You are a library and need to export your types… Make it fully public.

src/app/components/apexchart/apexchart.component.ts(2,35): error TS2305: Module '"apexcharts"' has no exported member 'ApexAxisChartSeries'.
src/app/components/events/events.component.ts(117,43): error TS2345: Argument of type 'true' is not assignable to parameter of type 'EntityChanged'.```
0reactions
iclemenscommented, Nov 4, 2020

Hey @junedchhipa, I think your fix is too simplistic as importing types like ApexAxisChartSeries is no longer possible.

A (very simplistic) use case for importing these types is:

import { ApexAxisChartSeries } from 'apexcharts';
const series: ApexAxisChartSeries = [{ name: "Name", data: [1, 2, 3, 4]}];

Exporting at least ApexAxisChartSeries would also allow you to properly type the series property here: https://github.com/apexcharts/react-apexcharts/blob/master/types/react-apexcharts.d.ts instead of just using Array<any>.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exports and export assignments are not permitted in ...
Module Augmentation: Typescript calls this a module augmentation: You are using an existing module and add new definitions to it.
Read more >
Compilation error: "Exports and export assignments are not ...
Description. Importing Splide in an Angular 12 app causes compilation error: Error: node_modules/@splidejs/splide/dist/types/index.
Read more >
Fixing Typescript error: TS2666: Exports and ... - Gary Sieling
Fixing Typescript error: TS2666: Exports and export assignments are not permitted in module augmentations.
Read more >
Writing a types declaration file for a library where one of the ...
Writing a types declaration file for a library where one of the exported functions is a function imported from another library. How should...
Read more >
TypeScript errors and how to fix them
error TS1218: Export assignment is not supported when '–module' flag is 'system'. ... With type-only imports and exports you cannot use a default...
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