echarts
echarts copied to clipboard
Type for datazoom event
trafficstars
Version
5.4.3
Link to Minimal Reproduction
No response
Steps to Reproduce
Create datazoom event Try to type
Current Behavior
For example, we have the following code: `myChart.on("dataZoom", event => { if (event.batch) { return dataZoom.value = { start: event.batch[0].start, end: event.batch[0].end }; }
dataZoom.value = { start: event.start, end: event.end };
});`
For the event TypeScript gives an error:
Argument of type (this: EChartsType, e: unknown) => { start: any; end: any; } | undefined is not assignable to parameter of type WithThisType<(...args: unknown[]) => boolean | void, EChartsType>
How to type an event?
Expected Behavior
Environment
- OS: macOS Sonoma
- Browser: Chrome 120.0.6099.129
- Framework: Vue@3
Any additional comments?
No response
Same problem, event has no type defined.
The doc is misleading
{
type: 'datazoom',
// percentage of zoom start position, 0 - 100
start: number
// percentage of zoom finish position, 0 - 100
end: number
// data value of zoom start position; only exists in zoom event of triggered by toolbar
startValue?: number
// data value of zoom finish position; only exists in zoom event of triggered by toolbar
endValue?: number
}