【发布时间】:2020-05-07 13:04:06
【问题描述】:
我在我的 Angular 项目中使用 Highchart,一切正常,但是当我将我的 Angular cli 更新到 9.1.4 时,声明开始抛出以下错误(错误截图https://prnt.sc/scl6g8)
Argument of type 'typeof import("/project/node_modules/highcharts/highcharts")' is not
assignable to parameter of type 'typeof import("/project/node_modules/highcharts/highcharts.src")'.
Property 'ZAxis' is missing in type 'typeof import("/project/node_modules/highcharts/highcharts")'
but required in type 'typeof import("/project/node_modules/highcharts/highcharts.src")'.ts(2345)
highcharts-3d.src.d.ts(19, 9): 'ZAxis' is declared here.
这里是导入语句
import { Component, OnInit, Input } from '@angular/core';
import * as Highcharts from 'highcharts';
import highcharts3D from 'highcharts/highcharts-3d.src';
highcharts3D(Highcharts); // the above error is thrown on this line
【问题讨论】:
-
有一个工作演示,没有错误发生。 codesandbox.io/s/angular-cz3nc?file=/src/app/chart.component.ts 尝试将
import highcharts3D from 'highcharts/highcharts-3d.src';更改为import * as Highcharts3d from "highcharts/highcharts-3d"; -
这张图片无助于理解您正在努力解决的问题。您可以使用我之前评论中的上述内容来重现它吗?
标签: angular typescript highcharts