amcharts4未使用角度6进行编译 [英] amcharts4 is not compiling with angular 6

查看:125
本文介绍了amcharts4未使用角度6进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

包含amcharts4时,我在编译我的应用程序时遇到了麻烦.我只安装了amcharts4 npm软件包,并试图在我创建的组件中使用它.我在CLI配置中缺少什么吗?

I'm having trouble with compiling my app when including amcharts4. I have simply installed the amcharts4 npm package and am trying to use it in a component i've created. Am i missing something with the CLI config?

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'.

我的打字稿:

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 {

}

推荐答案

此问题 此较新的已解决问题和我们的角度集成文档,请确保您拥有tsconfig.json中的以下内容(因为AmCharts 4当前不支持严格模式):

Per this issue this newer closed issue and our angular integration documentation, make sure you have the following in your tsconfig.json as AmCharts 4 does not currently support strict mode:

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

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

In addition to this, make sure you're at least on TypeScript version 2.7 2.8 but not 3.x as it isn't supported yet.

这篇关于amcharts4未使用角度6进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆