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

查看:20
本文介绍了amcharts4 未使用 angular 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 {

}

推荐答案

Per this问题 这个较新的已关闭问题和我们的角度集成文档,确保你有您的 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 未使用 angular 6 进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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