Skip to content

fix: accept every echarts init option in the opts type - #632

Open
Sam-Razavi wants to merge 1 commit into
hustcc:masterfrom
Sam-Razavi:fix/opts-type-echarts-init-options
Open

Sam-Razavi wants to merge 1 commit into
hustcc:masterfrom
Sam-Razavi:fix/opts-type-echarts-init-options

Conversation

@Sam-Razavi

Copy link
Copy Markdown
Contributor

Fixes #567

opts is passed straight to echarts.init, but its type was missing useDirtyRect, useCoarsePointer, pointerSize and ssr. It also only allowed a number or 'auto' for width/height (so '400px' failed) and a string for locale. This brings it in line with ECharts' EChartsInitOpts. It's type-only, with no runtime change.

Checked with tsc against a small consumer file: the new options, string sizes and a value typed as ECharts' own EChartsInitOpts all failed to type check before and pass now. width: 'auto' and height: null still work.

The added test renders a chart with every init option and checks that the renderer and string sizes reach the instance. It passes on master too, since the options already worked at runtime. It's there to cover the full set going forward.

This doesn't add server-side rendering itself (the "SSR support" part of the issue). It only lets ssr be passed without a type error.

Opts was missing useDirtyRect, useCoarsePointer, pointerSize and ssr,
and only allowed numbers or 'auto' for width/height and a string for
locale, so valid echarts.init options failed to type check. The
component already passes opts straight to echarts.init, so this is a
type-only change. Add a test that renders with every init option.

Fixes hustcc#567
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.737%. remained the same — Sam-Razavi:fix/opts-type-echarts-init-options into hustcc:master

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Required type Opts ( and add support for SSR)

2 participants