当你按照教程将highcharts示例加入到angular组件并且一切就绪后,点击编译后会发现编译失败,并且引发一个问题如下:
问题:error TS2559: Type 'number' has no properties in common with type 'XrangePointOptionsObject'.
如图:
解决措施:在options后面加个as any,这样就不会强迫你适用指定的类型type
如果您在构建/服务 Angular 应用程序时出现键入错误,以下内容可能会有所帮助:
// override options type with <any>
chart = new Chart({ options } as any);
这在使用gauge chart
类型时非常有用。