当包含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'.我的打字稿:
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 {
}发布于 2019-02-21 17:00:07
使用忽略typescript代码中错误的@ts-ignore表示法:
// @ts-ignore
import * as am4core from "@amcharts/amcharts4/core";
// @ts-ignore
import * as am4charts from "@amcharts/amcharts4/charts";并将typescript版本更新为最新版本:
npm install typescript@next --save对我来说是:"typescript": "^3.4.0-dev.20190220"
https://stackoverflow.com/questions/53416341
复制相似问题