You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/02/16 21:28:10 UTC
[incubator-echarts] 08/09: fix TS semantic error.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch typescript
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit e9a2af6a22490ff2ead7291e784cbb79908ed6cc
Author: 100pah <su...@gmail.com>
AuthorDate: Mon Feb 17 01:38:58 2020 +0800
fix TS semantic error.
---
src/util/model.ts | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/src/util/model.ts b/src/util/model.ts
index 7f7d33c..ccac59b 100644
--- a/src/util/model.ts
+++ b/src/util/model.ts
@@ -613,18 +613,16 @@ export function getTooltipRenderMode(renderModeOption: TooltipRenderMode | 'auto
/**
* Group a list by key.
- *
- * @param {Array} array
- * @param {Function} getKey
- * param {*} Array item
- * return {string} key
- * @return {Object} Result
- * {Array}: keys,
- * {module:zrender/core/util/HashMap} buckets: {key -> Array}
*/
-export function groupData(array, getKey) {
- var buckets = zrUtil.createHashMap();
- var keys = [];
+export function groupData<T>(
+ array: T[],
+ getKey: (item: T) => string // return key
+): {
+ keys: string[],
+ buckets: zrUtil.HashMap<T[]> // hasmap key: the key returned by `getKey`.
+} {
+ var buckets = zrUtil.createHashMap<T[]>();
+ var keys = [] as string[];
zrUtil.each(array, function (item) {
var key = getKey(item);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org