Skip to content

Commit f86fd00

Browse files
committed
fix: extend GenericComponentInstance interface
1 parent f55c356 commit f86fd00

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

packages/vue-i18n-core/src/devtools.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,11 @@ function getComponentInstance(
267267
nodeId: string,
268268
i18n: _I18n
269269
): ComponentInternalInstance | GenericComponentInstance | null {
270-
let instance: ComponentInternalInstance | null = null
270+
let instance: ComponentInternalInstance | GenericComponentInstance | null = null
271271

272272
if (nodeId !== 'global') {
273273
for (const [component, composer] of i18n.__instances.entries()) {
274274
if (composer.id.toString() === nodeId) {
275-
// @ts-expect-error -- TODO(kazupon): need to fix types
276275
instance = component
277276
break
278277
}

packages/vue-i18n-core/src/i18n.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ export function useI18n<
494494
throw createI18nError(I18nErrorCodes.MUST_BE_CALL_SETUP_TOP)
495495
}
496496
if (
497-
// @ts-expect-error -- TODO(kazupon): need to fix types
498497
!instance.isCE &&
499498
instance.appContext.app != null &&
500499
!instance.appContext.app.__VUE_I18N_SYMBOL__
@@ -565,13 +564,11 @@ function createGlobal(options: I18nOptions): [EffectScope, Composer] {
565564

566565
function getI18nInstance(instance: ComponentInternalInstance | GenericComponentInstance): I18n {
567566
const i18n = inject(
568-
// @ts-expect-error -- TODO(kazupon): need to fix types
569567
!instance.isCE ? instance.appContext.app.__VUE_I18N_SYMBOL__! : I18nInjectionKey
570568
)
571569
/* istanbul ignore if */
572570
if (!i18n) {
573571
throw createI18nError(
574-
// @ts-expect-error -- TODO(kazupon): need to fix types
575572
!instance.isCE ? I18nErrorCodes.UNEXPECTED_ERROR : I18nErrorCodes.NOT_INSTALLED_WITH_PROVIDE
576573
)
577574
}

packages/vue-i18n-core/src/vue.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ declare module 'vue' {
1414
export interface ComponentInternalInstance {
1515
/**
1616
* @internal
17-
* iskk custom element?
17+
* whether target component is custom element
18+
*/
19+
isCE?: boolean
20+
}
21+
22+
export interface GenericComponentInstance {
23+
/**
24+
* @internal
25+
* whether target component is custom element
1826
*/
1927
isCE?: boolean
2028
}

0 commit comments

Comments
 (0)