We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getCurrentInstance
1 parent d06b72c commit ccafe82Copy full SHA for ccafe82
packages/vue-i18n-core/src/utils.ts
@@ -223,6 +223,13 @@ export function getCurrentInstance():
223
| GenericComponentInstance
224
| ComponentInternalInstance
225
| null {
226
- // @ts-ignore -- NOTE(kazupon): for Vue 3.6
227
- return Vue.currentInstance || Vue.getCurrentInstance()
+ if ('currentInstance' in Vue) {
+ // NOTE(kazupon): avoid bundler static analysis
228
+ const name = 'current' + 'Instance'
229
+ return (Vue as any)[name] as GenericComponentInstance | null
230
+ } else {
231
+ return Vue.getCurrentInstance()
232
+ }
233
}
234
+
235
+/* eslint-enable @typescript-eslint/no-explicit-any */
0 commit comments