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

fix(dataZoom): type fix for startValue and endValue. close #14412 #14775

Merged
merged 2 commits into from
May 12, 2021

Conversation

dileepyelleti
Copy link
Contributor

@dileepyelleti dileepyelleti commented Apr 23, 2021

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Fixes Type error while using dataZoom.startValue, dataZoom.endValue

Fixed issues

Details

Before: What was the problem?

dataZoom.startValue, dataZoom.endValue supports number | string | Date but in types allowing only number. This is leading to error - Type 'string' is not assignable to type 'number'

After: How is it fixed in this PR?

Now dataZoom.startValue, dataZoom.endValue supports number | string | Date

Misc

  • The API has been changed (apache/echarts-doc#xxx).
  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

NA.

Others

Merging options

  • Please squash the commits into a single one when merge.

Other information

@echarts-bot
Copy link

echarts-bot bot commented Apr 23, 2021

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

@echarts-bot echarts-bot bot added PR: awaiting doc Document changes is required for this PR. and removed PR: awaiting doc Document changes is required for this PR. labels May 10, 2021
@@ -506,9 +506,12 @@ class DataZoomModel<Opts extends DataZoomOption = DataZoomOption> extends Compon

setCalculatedRange(opt: RangeOption): void {
const option = this.option;
each(['start', 'startValue', 'end', 'endValue'] as const, function (name) {
each(['start', 'end'] as const, function (name) {
option[name] = opt[name];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to use (option as any)[name] = opt[name] here to avoid writing the logic twice. Code size is also important.

@pissang pissang requested a review from 100pah May 11, 2021 04:20
@pissang pissang added this to the 5.1.2 milestone May 11, 2021
@dileepyelleti dileepyelleti requested a review from pissang May 11, 2021 14:15
@pissang pissang merged commit f97b7fa into apache:master May 12, 2021
@echarts-bot
Copy link

echarts-bot bot commented May 12, 2021

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants