apache / apache/echarts

Type for datazoom event

Open
#19,571 2 comments 1 reaction 0 assignees View on GitHub
bug en pending waiting-for: author
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### 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

```markdown
- OS: macOS Sonoma
- Browser: Chrome 120.0.6099.129
- Framework: Vue@3
```

### Any additional comments?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.