apache / apache/echarts

TypeError: on using model for dataset.source

Open
#14,418 3 comments 0 reactions 0 assignees View on GitHub
bug en typescript
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version
5.0.2

### Steps to reproduce
Suppose we have a model for data like below
```javascript
export class SourceTestModel {
'xValue': string;
'yValue': number;
}

data: SourceTestModel[] = [ // If we are getting this from api
{xValue: first, yValue: 25},
{xValue: second, yValue: 50}
];
```
And we use this data in dataset.source like
```javascript
dataset: {
dimensions: ['xValue', 'yValue'],
source: data // Throws type error
}
```

### What is expected?
It should not through any typescript errors

### What is actually happening?
Type 'SourceTestModel[]' is not assignable to type 'OptionSourceData>'

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.