typeScript中遇到的鸟问题及解决

2019-08-27  本文已影响0人  春木橙云

最近在使用angular+typescript做项目,遇到这个鸟问题,解决它任务减轻大半,开心哈哈哈哈!

类型“HTMLElement”的参数不能赋给类型“HTMLDivElement | HTMLCanvasElement”的参数。
  Type 'HTMLElement' is missing the following properties from type 'HTMLCanvasElement': height, width, getContext, toBlob, and 2 more.ts(2345)
const myChart:any = echarts.init(document.getElementById('main'));
const mainElement = <HTMLCanvasElement>document.getElementById('main');
const myChart: any = echarts.init(mainElement)

lalala the end!

上一篇 下一篇

猜你喜欢

热点阅读