我在包含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 {
}
最佳答案 根据
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,因为它尚不支持.