apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.63k stars 19.61k forks source link

[Bug] Type issue: Property x,y,width,height does not exist on type CustomSeriesRendererItemParamsCoordSys #18200

Closed infacto closed 1 year ago

infacto commented 1 year ago

Version

5.4.1

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?c=custom-profile

Steps to Reproduce

Check out the link above. It's one of the examples of ECharts (line 47). Thanks btw. It's a great chart lib and deserves more attention as chart.js in my opinion. Anyway...

I just copied the example code and added some types for TypeScript by checking what types are expected here.

Current Behavior

For the renderItem method argument params CustomSeriesRenderItemParams, I get the error that params.coordSys.x (also y, width and height do not exsit on that type.) But at runtime it works. Maybe a type issue? Or is there another derived type I should use?

interface CustomSeriesRenderItemParamsCoordSys {
    type: string;
}

There is only type property.

Expected Behavior

Types should work well for a library written in TypeScript. What is great btw.

Workaround: Modify (extend) type or use any or unknown. Not the best solution.

Environment

- OS: Win 10 Pro 64-bit 22H2
- Browser: Chrome 109
- Framework: TypeScript (Angular)

Any additional comments?

No matter, but I use echarts directly in Angular. (Not ngx-echarts.)

screenshot

Ovilia commented 1 year ago

This is not a bug. Please see the discussion at #17636.