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

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


The following commit(s) were added to refs/heads/aggregate-transform by this 
push:
     new 6b4b944  style: optimize code
6b4b944 is described below

commit 6b4b94418c2a7d111f4ed30146dd277efa62fad2
Author: pissang <bm2736...@gmail.com>
AuthorDate: Wed Mar 23 20:12:22 2022 +0800

    style: optimize code
---
 src/component/transform/aggregateTransform.ts | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/component/transform/aggregateTransform.ts 
b/src/component/transform/aggregateTransform.ts
index ac225dd..e4f070d 100644
--- a/src/component/transform/aggregateTransform.ts
+++ b/src/component/transform/aggregateTransform.ts
@@ -366,17 +366,17 @@ const methods: {
         init: (curr) => [curr],
         add(prev, curr) {
             // FIXME: handle other types
-            (prev as any).push(curr);
+            (prev as OptionDataValue[]).push(curr);
             return prev;
         }
     },
     SUM: {
         init: identity,
-        add: (prev, curr) => prev as number + (curr as number)
+        add: (prev: number, curr: number) => prev + curr
     },
     COUNT: {
         init: () => 1,
-        add: (prev) => (prev as number)++
+        add: (prev: number) => prev++
     },
     FIRST: {
         init: identity,
@@ -384,16 +384,16 @@ const methods: {
     },
     MIN: {
         init: identity,
-        add: (prev, curr) => Math.min(prev as number, curr as number)
+        add: (prev: number, curr: number) => Math.min(prev, curr)
     },
     MAX: {
         init: identity,
-        add: (prev, curr) => Math.max(prev as number, curr as number)
+        add: (prev: number, curr: number) => Math.max(prev, curr)
     },
     AVERAGE: {
-        init: (curr, aggResult, groupByVal) => (curr as number) / 
(aggResult.dep.get(groupByVal) as number),
-        add: (prev, curr, aggResult, groupByVal) =>
-            (prev as number) + (curr as number) / 
(aggResult.dep.get(groupByVal) as number),
+        init: (curr: number, aggResult, groupByVal) => curr / 
(aggResult.dep.get(groupByVal) as number),
+        add: (prev: number, curr: number, aggResult, groupByVal) =>
+            prev + curr / (aggResult.dep.get(groupByVal) as number),
         dep: 'COUNT'
     },
     Q1: {

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

Reply via email to