From 1d4d0d0302e309f65df7acea9fc99dd560c24f75 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Wed, 6 Jul 2022 15:19:29 +0800 Subject: [PATCH] feat: provide better types for injection keys --- src/ECharts.ts | 15 ++++++++------- src/composables/loading.ts | 8 +++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/ECharts.ts b/src/ECharts.ts index d036fe9..e569229 100644 --- a/src/ECharts.ts +++ b/src/ECharts.ts @@ -14,7 +14,8 @@ import { nextTick, PropType, watchEffect, - Vue2 + Vue2, + InjectionKey } from "vue-demi"; import { init as initChart } from "echarts/core"; import { @@ -44,9 +45,9 @@ if (Vue2) { Vue2.config.ignoredElements.push(TAG_NAME); } -export const THEME_KEY = "ecTheme"; -export const INIT_OPTIONS_KEY = "ecInitOptions"; -export const UPDATE_OPTIONS_KEY = "ecUpdateOptions"; +export const THEME_KEY = "ecTheme" as unknown as InjectionKey; +export const INIT_OPTIONS_KEY = "ecInitOptions" as unknown as InjectionKey; +export const UPDATE_OPTIONS_KEY = "ecUpdateOptions" as unknown as InjectionKey; export { LOADING_OPTIONS_KEY } from "./composables"; export default defineComponent({ @@ -69,15 +70,15 @@ export default defineComponent({ const root = shallowRef(); const chart = shallowRef(); const manualOption = shallowRef