gevgeny / angular2-highcharts

:bar_chart: :chart_with_upwards_trend: Highcharts for your Angular project
MIT License
380 stars 113 forks source link

Typing issue: Cannot find name "HighstockOptions" #84

Open yuanfeiz opened 8 years ago

yuanfeiz commented 8 years ago

Version: ^0.3.4

I used to encounter the duplicated identifiers problem, after upgrading to the latest version, that issue was fixed while Highstock still seems to be not correctly imported.

Related errors:

andre-huehn commented 7 years ago

Why did you close this? I have the same issue. The problem is, that all the HighStock typings are not imported in the index.d.ts in the package @types/highcharts.

gevgeny commented 7 years ago

@Icer2000 Could you provide some more code to reproduce the issue with v0.4.0 ?

andre-huehn commented 7 years ago

I never created a Plunkr, but i can descripe the problem pretty well: packages.json :

dependencies: [
"angular2-highcharts": "0.4.1",
"highcharts": "^5.0.2"],
devDependencies: [
"@types/core-js": "^0.9.34",
  "@types/highcharts": "^4.2.38"
]

If you now use a tsconfig.json file and compile your app with gulp-typescript using typescript 2.0.6 it will not find the Highstock Type definitions, because by default only the index.d.ts is picked up for typescript compilation.

You should include the Highstock typings in the index.d.ts file of the package @types/highcharts.

Hope this helped. :)

yuanfeiz commented 7 years ago

There are two files inside @types/highcharts:

  1. index.d.ts: containing all the definitions about highcharts.
  2. highstocks.d.ts: containing extensions of highstocks over highcharts.

To declare a property as some type of highcharts, for example to declare a chart object as a ChartObject of highstock is currently not available. I might be wrong, but there is not export in the highstock.d.ts, which prevents it from giving out the typing information.

yuanfeiz commented 7 years ago

Found a fix for this DefinitelyTyped/DefinitelyTyped#13232