You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/12/21 05:25:34 UTC

[incubator-echarts] branch treeshakable-exports updated: refact(ts): only one params is needed in ComposeOption

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch treeshakable-exports
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git


The following commit(s) were added to refs/heads/treeshakable-exports by this push:
     new 9f65b06  refact(ts): only one params is needed in ComposeOption
9f65b06 is described below

commit 9f65b068fc46ce65ccde6e0ba85f9b991e064811
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Dec 21 13:24:14 2020 +0800

    refact(ts): only one params is needed in ComposeOption
---
 src/export/core.ts          | 16 +++++++---------
 test/types/importPartial.ts |  4 ++--
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/export/core.ts b/src/export/core.ts
index a7991c2..6165803 100644
--- a/src/export/core.ts
+++ b/src/export/core.ts
@@ -17,7 +17,7 @@
 * under the License.
 */
 
-import { ComponentOption, ECBasicOption as EChartsCoreOption, SeriesOption } from '../util/types';
+import { ComponentOption, ECBasicOption as EChartsCoreOption } from '../util/types';
 
 export * from '../echarts';
 export * from './api';
@@ -26,15 +26,13 @@ export {EChartsType as ECharts} from '../echarts';
 
 export {EChartsCoreOption};
 
-type ComposeUnitOption<ComponentsOptionUnion extends ComponentOption, SeriesOptionUnion extends SeriesOption> =
+type ComposeUnitOption<OptionUnion extends ComponentOption = never> =
     EChartsCoreOption & {
-        [key in ComponentsOptionUnion['mainType']]?: ComponentsOptionUnion | ComponentsOptionUnion[];
-    } & {
-        series?: SeriesOptionUnion | SeriesOptionUnion[]
+        [key in OptionUnion['mainType']]?: OptionUnion | OptionUnion[];
     };
 
-export type ComposeOption<ComponentsOptionUnion extends ComponentOption, SeriesOptionUnion extends SeriesOption> =
-    ComposeUnitOption<ComponentsOptionUnion, SeriesOptionUnion> & {
-        baseOption?: ComposeUnitOption<ComponentsOptionUnion, SeriesOptionUnion>
-        options?: ComposeUnitOption<ComponentsOptionUnion, SeriesOptionUnion>[]
+export type ComposeOption<OptionUnion extends ComponentOption> =
+    ComposeUnitOption<OptionUnion> & {
+        baseOption?: ComposeUnitOption<OptionUnion>
+        options?: ComposeUnitOption<OptionUnion>[]
     };
\ No newline at end of file
diff --git a/test/types/importPartial.ts b/test/types/importPartial.ts
index d75d2f3..bb49c07 100644
--- a/test/types/importPartial.ts
+++ b/test/types/importPartial.ts
@@ -19,8 +19,8 @@ import {
 use([BarChart, LineChart, GridComponent, DataZoomComponent, CanvasRenderer]);
 
 type Option = ComposeOption<
-    GridComponentOption | DataZoomComponentOption,
-    BarSeriesOption | LineSeriesOption
+    GridComponentOption | DataZoomComponentOption
+    | BarSeriesOption | LineSeriesOption
 >;
 
 const option: Option= {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org