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

feat(type): export EChartsInitOpts and some Payload types for echarts/core #19103

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

dalenguyen
Copy link
Contributor

@dalenguyen dalenguyen commented Sep 11, 2023

Brief Information

Add missing types

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Expose useful types, so it can be imported via echarts

Fixed issues

#19003

Details

Before: What was the problem?

In order to import types that not publicly expose via echarts, the current behaviour is something like this

import { SelectChangedPayload } from 'echarts/types/src/util/types'

After: How does it behave after the fixing?

After the change, users could import type in a correct way:

import { SelectChangedPayload } from 'echarts'

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

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

Other information

@echarts-bot
Copy link

echarts-bot bot commented Sep 11, 2023

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.

⚠️ MISSING DOCUMENT INFO: Please make sure one of the document options are checked in this PR's description. Search "Document Info" in the description of this PR. This should be done either by the author or the reviewers of the PR.

@yay
Copy link

yay commented Sep 11, 2023

Great to see this, thanks!

I found a couple more issues with types: #19003 (comment)

export { RadialGradientObject } from 'zrender/src/graphic/RadialGradient';
export { PatternObject, ImagePatternObject, SVGPatternObject } from 'zrender/src/graphic/Pattern';
export { ElementEvent } from 'zrender/src/Element';
export * from './option';
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about this line. @pissang Do we miss an echarts/option entry or echarts/all entry? It seems we can only import them from echarts/types/dist folder now. Please take a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@plainheart, you're right. I was looking for the incorrect type name for the option.

For example,

interface EChartsOption extends ECBasicOption {
    dataset?: DatasetOption | DatasetOption[];
    aria?: AriaOption;
    title?: TitleOption | TitleOption[];
    grid?: GridOption | GridOption[];
    radar?: RadarOption | RadarOption[];
    polar?: PolarOption | PolarOption[];
    geo?: GeoOption | GeoOption[];
    angleAxis?: AngleAxisOption | AngleAxisOption[];
    radiusAxis?: RadiusAxisOption | RadiusAxisOption[];
    xAxis?: XAXisOption | XAXisOption[];
    yAxis?: YAXisOption | YAXisOption[];
    singleAxis?: SingleAxisOption | SingleAxisOption[];
    parallel?: ParallelCoordinateSystemOption | ParallelCoordinateSystemOption[];
    parallelAxis?: ParallelAxisOption | ParallelAxisOption[];
    calendar?: CalendarOption | CalendarOption[];
    toolbox?: ToolboxComponentOption | ToolboxComponentOption[];
    tooltip?: TooltipOption | TooltipOption[];
    axisPointer?: AxisPointerOption | AxisPointerOption[];
    brush?: BrushOption | BrushOption[];
    timeline?: TimelineOption | SliderTimelineOption;
    legend?: LegendComponentOption | (LegendComponentOption)[];
    dataZoom?: DataZoomComponentOption | (DataZoomComponentOption)[];
    visualMap?: VisualMapComponentOption | (VisualMapComponentOption)[];
    graphic?: GraphicComponentLooseOption | GraphicComponentLooseOption[];
    series?: SeriesOption$1 | SeriesOption$1[];
    options?: EChartsOption[];
    baseOption?: EChartsOption;
}

I was looking to import TooltipOption type. However, it's already exported as TooltipComponentOption, which is a little confusing when looking at the type.

I will revert this change.

@plainheart plainheart changed the title feat: add missing types feat(type): export EChartsInitOpts and more types for echarts/core Sep 11, 2023
@plainheart plainheart added this to the 5.5.0 milestone Sep 11, 2023
@github-actions
Copy link
Contributor

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19103@a207f4f

@plainheart plainheart merged commit de074fb into apache:master Sep 12, 2023
2 checks passed
@echarts-bot
Copy link

echarts-bot bot commented Sep 12, 2023

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

@plainheart plainheart changed the title feat(type): export EChartsInitOpts and more types for echarts/core feat(type): export EChartsInitOpts and some Payload types for echarts/core Sep 12, 2023
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.

3 participants