angular - amcharts4 没有用 angular 6 编译

标签 angular amcharts

在包含 amcharts4 时,我在编译我的应用程序时遇到了问题。我只是安装了 amcharts4 npm 包,并试图在我创建的组件中使用它。我是否遗漏了 CLI 配置的某些内容?

ERROR in node_modules/@amcharts/amcharts4/.internal/core/utils/Object.d.ts(60,117): error TS2536: Type 'Key' cannot be used to index type 'Object'.
node_modules/@amcharts/amcharts4/.internal/core/utils/Object.d.ts(67,109): error TS2536: Type 'Key' cannot be used to index type 'Object'.
node_modules/@amcharts/amcharts4/.internal/core/utils/Object.d.ts(76,116): error TS2536: Type 'Key' cannot be used to index type 'Object'.
node_modules/@amcharts/amcharts4/.internal/core/utils/Type.d.ts(25,32): error TS2304: Cannot find name 'Extract'.

我的 typescript :

import { Component, NgZone } from "@angular/core";
import * as am4core from "@amcharts/amcharts4/core";
import * as am4charts from "@amcharts/amcharts4/charts";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";

am4core.useTheme(am4themes_animated);


@Component({
  selector: 'app-am-charts',
  templateUrl: './am-charts.component.html',
  styleUrls: ['./am-charts.component.css']
})
export class AmChartsComponent {

}

最佳答案

根据 this issue this newer closed issue和我们的 angular integration documentation ,请确保您的 tsconfig.json 中包含以下内容,因为 AmCharts 4 当前不支持严格模式:

{
    "compilerOptions": {
        "strictNullChecks": false,
        "strictFunctionTypes": false
    }
}

除此之外,请确保您至少使用 TypeScript 版本 2.7 2.8 但不是 3.x,因为它尚不受支持。

关于angular - amcharts4 没有用 angular 6 编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53416341/

相关文章:

javascript - 如何在 amCharts 面积图中添加自定义元素符号?

javascript - 如何将数据从子级传递给父级: Angular Color Picker [(colorPicker)]

angular - 'p-header' 在 PrimeNg for Angular2 应用程序中不是已知元素

javascript - AJAX 响应后重新加载 amchart

javascript - 在 Amcharts 中动态改变 valueAxis

javascript - AmCharts 中是否可以使序列图表中的条形占据全宽?

javascript - 从函数中使用数据加载器时,Amchart 未显示

javascript - 登录 post 请求生成错误

angular - HTML 中的自定义属性绑定(bind)

Angular 4 *ngIf 条件在 IE 中不起作用但在 Chrome 中起作用