Open munrocket opened 6 years ago
Thank you for your report! Could you please specify which things we should fix or refactor to avoid compilation troubles? Now anychart namespaces are declared in node module anychart/dist/index.d.ts
@Shestac92
When i trying to use import { anychart } from 'anychart'
or import * as anychart from 'anychart'
I have got error: /dist/index.d.ts is not a module.
So, I can't import it in Angular 5 normally. I guess same thing in Angular 4.
As i understand you should have to use this template and warp like this https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-class-d-ts.html
Also here manual about modules: https://www.typescriptlang.org/docs/handbook/module-resolution.html
@munrocket thank you for clarification and helpful links! Our dev team will investigate this issue and solve it. We will inform you when an update comes.
@munrocket
To avoid the issue you noticed you should import anychart with the following lines:
/// <reference types="anychart" />
import 'anychart';
Also, this morning we've updated our example which shows how to use Anychart with Angular4. You may check that import like above works well in that example. You may find it here. It works the same for Angular 5. I want to warn, that you will get several warnings related to .css during the compiler work - it's ok, we gonna fix it in the next release.
@munrocket We are glad to inform you that we have fixed warnings related to CSS while compiling. The fixed dev-preview is available with the following managers: yarn add anychart@8.1.0-dev-preview-2 npm install anychart@8.1.0-dev-preview-2
Also, the fix will be included in the next public release.
@munrocket Our team has released a public 8.2.1 update and you can try it in your projects. This update includes many bug fixes of index.d.ts. To get this update execute 'npm update' or replace in 'package.json' the current AnyChart dependence with the following "anychart": "8.2.1" Or you can download it manually via NPM: $ npm install anychart@8.2.1
Nice
This library without module in defenition, so typescript debugger throw errors. Of course you can use it that way, but it's pretty dirty. Why you don't wraped anychart namespace into typescript module or created @type/anychart?
We can use this code example only after the second compilation.