我想得到一个类似的图表在React项目使用typescript-https://www.highcharts.com/demo/maps/flowmap
flowmap模块在highcharts中以.js文件的形式出现,而不是.ts文件。
因此,连接模块的尝试
import HighchartsMap from 'highcharts/highmaps';
import HighchartsReact from 'highcharts-react-official';
import HighchartsFlowmap from 'highcharts/modules/flowmap'
HighchartsFlowmap(HighchartsMap);
return <HighchartsReact highcharts={HighchartsMap} options={options} constructorType='mapChart' />;
导致错误:
TS7016: Could not find a declaration file for module 'highcharts/modules/flowmap'. '.../node_modules/highcharts/modules/flowmap.js' implicitly has an 'any' type.
If the 'highcharts' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'highcharts/modules/flowmap';`
请告诉我如何解决这个问题
1条答案
按热度按时间o2g1uqev1#
流程图系列可从Highcharts 11v获得。请确保您使用正确的版本。
加载模块的替代方法:
Demo:https://stackblitz.com/edit/react-ts-c8vikm?file=package.json,index.tsx,index.html