apache / apache/echarts

[Bug] getOption() 返回的类型不匹配

Open
#17,632 1 comment 0 reactions 0 assignees View on GitHub
bug typescript
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

e.g.5.3.2

### Link to Minimal Reproduction

_No response_

### Steps to Reproduce

1. 使用 TypeScript
2. 调用 instance.getOption() 返回类型提示是 ECBasicOption,但实际返回类似于 {
title: [{...}],
legend: [{...}],
grid: [{...}]
}
3. 所以使用 instance.getOption().legend[0] 会提示类型错误
元素隐式具有 "any" 类型,因为类型为 "0" 的表达式不能用于索引类型 "{}"。
类型“{}”上不存在属性“0”。

### Current Behavior

instance.getOption() 返回类型错误

### Expected Behavior

instance.getOption() 返回类型和实际一至

### Environment

```markdown
- OS:
- Browser:
- Framework:
```

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