Skip to content

Commit beec263

Browse files
committed
fix: fix type for autoresize, closes #800
1 parent b366b31 commit beec263

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 7.0.1
2+
3+
* Fixed type for `autoresize`.
4+
15
## 7.0.0
26

37
> Other prerelease changes:

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-echarts",
3-
"version": "7.0.0",
3+
"version": "7.0.1",
44
"description": "Vue.js component for Apache ECharts™.",
55
"license": "MIT",
66
"repository": "https://github.com/ecomfe/vue-echarts.git",

src/composables/autoresize.ts

+3-10
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@ import { watch } from "vue-demi";
22
import { throttle } from "echarts/core";
33

44
import type { Ref, PropType } from "vue-demi";
5-
import type { EChartsType } from "../types";
6-
7-
type AutoresizeProp =
8-
| boolean
9-
| {
10-
throttle?: number;
11-
onResize?: () => void;
12-
};
5+
import type { EChartsType, AutoResize } from "../types";
136

147
export function useAutoresize(
158
chart: Ref<EChartsType | undefined>,
16-
autoresize: Ref<AutoresizeProp | undefined>,
9+
autoresize: Ref<AutoResize | undefined>,
1710
root: Ref<HTMLElement | undefined>
1811
): void {
1912
watch(
@@ -63,5 +56,5 @@ export function useAutoresize(
6356
}
6457

6558
export const autoresizeProps = {
66-
autoresize: [Boolean, Object] as PropType<AutoresizeProp>
59+
autoresize: [Boolean, Object] as PropType<AutoResize>
6760
};

src/types.ts

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ export type EventTarget = EChartsType | ZRenderType;
2323
type SetOptionType = EChartsType["setOption"];
2424
export type Option = Parameters<SetOptionType>[0];
2525

26+
export type AutoResize =
27+
| boolean
28+
| {
29+
throttle?: number;
30+
onResize?: () => void;
31+
};
32+
2633
export type LoadingOptions = {
2734
text?: string;
2835
textColor?: string;

0 commit comments

Comments
 (0)