amcharts / amcharts4

The most advanced amCharts charting library for JavaScript and TypeScript apps.
https://www.amcharts.com/
1.16k stars 321 forks source link

typescript >= 3 support #420

Closed AndrewK15 closed 5 years ago

AndrewK15 commented 5 years ago

I'm getting these errors when trying to use amchartsv4 (4.0.0-beta.55) in angular7.rc0 + typescript 3.1.1.

Does it mean amcharts do not support typescript v3 at the moment and I should downgrade?

ERROR in node_modules/@amcharts/amcharts4/.internal/charts/elements/NavigationBar.d.ts(171,5): error TS2416: Property 'validateDataElement' in type 'NavigationBar' is not assignable to the same property in base type 'Component'.
  Type '(dataItem: NavigationBarDataItem) => void' is not assignable to type '(dataItem: this["_dataItem"]) => void'.
    Types of parameters 'dataItem' and 'dataItem' are incompatible.
      Type 'this["_dataItem"]' is not assignable to type 'NavigationBarDataItem'.
        Type 'DataItem' is not assignable to type 'NavigationBarDataItem'.
          Property 'name' is missing in type 'DataItem'.
node_modules/@amcharts/amcharts4/.internal/charts/types/ChordDiagram.d.ts(190,5): error TS2416: Property 'links' in type 'ChordDiagram' is not assignable to the same property in base type 'FlowDiagram'.
  Type 'ListTemplate<ChordLink>' is not assignable to type 'ListTemplate<this["_link"]>'.
    Type 'ChordLink' is not assignable to type 'this["_link"]'.
      Type 'ChordLink' is not assignable to type 'FlowDiagramLink'.
        Types of property 'copyFrom' are incompatible.
          Type '(source: ChordLink) => void' is not assignable to type '(source: this["_link"]) => void'.
            Types of parameters 'source' and 'source' are incompatible.
              Type 'this["_link"]' is not assignable to type 'ChordLink'.
                Type 'FlowDiagramLink' is not assignable to type 'ChordLink'.
                  Property 'radius' is missing in type 'FlowDiagramLink'.
node_modules/@amcharts/amcharts4/.internal/charts/types/SankeyDiagram.d.ts(162,5): error TS2416: Property 'links' in type 'SankeyDiagram' is not assignable to the same property in base type 'FlowDiagram'.
  Type 'ListTemplate<SankeyLink>' is not assignable to type 'ListTemplate<this["_link"]>'.
    Type 'SankeyLink' is not assignable to type 'this["_link"]'.
      Type 'SankeyLink' is not assignable to type 'FlowDiagramLink'.
        Types of property 'copyFrom' are incompatible.
          Type '(source: SankeyLink) => void' is not assignable to type '(source: this["_link"]) => void'.
            Types of parameters 'source' and 'source' are incompatible.
              Type 'this["_link"]' is not assignable to type 'SankeyLink'.
                Type 'FlowDiagramLink' is not assignable to type 'SankeyLink'.
                  Property 'startX' is missing in type 'FlowDiagramLink'.
Pauan commented 5 years ago

@AndrewK15 TypeScript 3.0 has a bunch of breaking changes. We're working on making AmCharts 4 compatible with TypeScript 3.0, but in the meantime we recommend downgrading to 2.x

eliashdezr commented 5 years ago

@Pauan any news on this?

erichstark commented 5 years ago

Today I also upgraded to angular 7 and typescript 3.1.3. With amcharts 4.0.0-beta.63 problem still exists.

billfranklin commented 5 years ago

can confirm @erichstark, have the same problem

Pauan commented 5 years ago

While working on TypeScript 3.0 support, we noticed that TypeScript 3.0 causes major slowdowns for compile times. We're working on creating a reduced test case so we can submit it to the TypeScript dev team.

billfranklin commented 5 years ago

@Pauan do you have an estimated timeframe on when the compile issues will be fixed, irrespective of the slowdown issue?

dellax commented 5 years ago

Temporary solution: add "skipLibCheck": true to tsconfig.json

Pauan commented 5 years ago

@billfranklin We've already fixed all the issues, but we can't release it until the major slowdown is fixed.

@dellax That's great! It must be a new option, I don't remember it existing before.

billfranklin commented 5 years ago

@Pauan did the update from 4 days ago fix this? It seems it might be related to slowdown issues in projects with many source files https://github.com/Microsoft/TypeScript/issues/28025

billfranklin commented 5 years ago

@dellax genius!

Pauan commented 5 years ago

@billfranklin Unfortunately, I don't think it fixed it. However, I submitted a bug report to the TypeScript team and they're looking into it.

billfranklin commented 5 years ago

@Pauan, at least they have a workaround from the looks of it?

weswigham commented 5 years ago

Yeah, there's a workaround posted in the thread and a fix committed to master that'll ship in 3.2.

DanielRosenwasser commented 5 years ago

Check out TypeScript 3.1.6 for the fix.

DanielRosenwasser commented 5 years ago

Sorry, not 3.1.6; someone linked to a separate issue which is addresed in 3.1.6.

Pauan commented 5 years ago

Good news! The next release of AmCharts will include TypeScript 3.0 support. We hope to have it out by tomorrow, but we can't promise that.

martynasma commented 5 years ago

Fixed in 4.0.0-beta.72.

[4.0.0-beta.72] - 2018-11-03

Changed

Fixed

Full change log.

Make sure you clear your browser cache after upgrading. And feel free to contact us again if you are still experiencing this issue.