Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Wrong TypeScript type for ParallelSeriesDataItemOption value property #18411

Closed
rettrich opened this issue Mar 22, 2023 · 1 comment · Fixed by #18425
Closed

[Bug] Wrong TypeScript type for ParallelSeriesDataItemOption value property #18411

rettrich opened this issue Mar 22, 2023 · 1 comment · Fixed by #18425
Labels
bug difficulty: easy Issues that can be fixed more easily than the average. typescript

Comments

@rettrich
Copy link

Version

5.4.1

Link to Minimal Reproduction

https://codesandbox.io/s/nostalgic-feather-21wlum?file=/src/index.ts

Steps to Reproduce

See minimal reproduction example.
The JS code of course still works, but the typescript compiler complains about wrong types.

Current Behavior

The typescript compiler shows an error when creating a ParallelSeriesOption object like shown in the minimal reproduction example. This is because the ParallelSeriesOptionDataItem type is declared wrongly.
The documentation (https://echarts.apache.org/en/option.html#series-parallel.data) states, that the data property of a ParallelSeriesOption is an array, where the elements of the array are either arrays containing the data to be displayed, or objects with a property value containing the data to be displayed, e.g.:
[
[4, 33, 7, 29, 0.33, 16, 6, 'excellent'],
{ // Data item can also be an Object, so that perticular settings of its line can be set here.
value: [5, 42, 24, 44, 0.76, 40, 16, 'excellent']
lineStyle: {...},
}
...
]
The problem is that the type is declared like this

value?: ParallelSeriesDataValue[]

but ParallelSeriesDataValue is
type ParallelSeriesDataValue = OptionDataValue[];

, where OptionDataValue is just defined as number | string | undefined,
making the value property a 2D array, which it shouldn't be.

Expected Behavior

Change the type in

value?: ParallelSeriesDataValue[]

to value?: ParallelSeriesDataValue (simply remove square brackets).

Environment

No response

Any additional comments?

No response

@rettrich rettrich added the bug label Mar 22, 2023
@Ovilia Ovilia added typescript difficulty: easy Issues that can be fixed more easily than the average. labels Mar 23, 2023
@Ovilia Ovilia added this to the TBD milestone Mar 23, 2023
@manishdait
Copy link
Contributor

I will like to work on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug difficulty: easy Issues that can be fixed more easily than the average. typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants