-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Closed
Labels
docDocument or Website related issues.Document or Website related issues.enThis issue is in EnglishThis issue is in Englishresolved
Description
Version
5.4.2
Link to Minimal Reproduction
Steps to Reproduce
- Go to line-stack example and ensure TS is enabled
- Replace the legend option with
legend: { data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine'], selector: [{type: 'all or inverse'}] } - See the error message "Type '"all or inverse"' is not assignable to type 'SelectorType'.(2322)"
Current Behavior
When using 'all or inverse' as a SelectorType in the legend options, a type error in typescript will occur.
https://echarts.apache.org/en/option.html#legend.selector shows the three types available. But only 2 will have the correct type.
Expected Behavior
The documented type should be available and not produce a type error.
Environment
- OS: Linux
- Browser: -
- Framework: Vue3Any additional comments?
| type SelectorType = 'all' | 'inverse'; |
When using as a package, this diff solved the problem:
Index: node_modules/echarts/types/dist/echarts.d.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/node_modules/echarts/types/dist/echarts.d.ts b/node_modules/echarts/types/dist/echarts.d.ts
--- a/node_modules/echarts/types/dist/echarts.d.ts
+++ b/node_modules/echarts/types/dist/echarts.d.ts (date 1684230367392)
@@ -3259,7 +3259,7 @@
getLineStyle(this: Model, excludes?: readonly (keyof LineStyleOption)[]): LineStyleProps;
}
-declare type SelectorType = 'all' | 'inverse';
+declare type SelectorType = 'all' | 'inverse' | 'all or inverse';
interface LegendSelectorButtonOption {
type?: SelectorType;
title?: string;
@@ -10916,4 +10916,4 @@
baseOption?: EChartsOption;
}
Adding the third option to the type solves the problem :-)
Metadata
Metadata
Assignees
Labels
docDocument or Website related issues.Document or Website related issues.enThis issue is in EnglishThis issue is in Englishresolved