fix: useI18nMeta — remove RouteMeta import, fix callable narrowing, fix resolveI18nCustomTags return type

This commit is contained in:
BarnacleBoy 2026-05-18 12:49:19 +00:00
parent 8971d0ddf2
commit 75d5cf24ad

View file

@ -2,7 +2,7 @@ import { computed, type ComputedRef, type Ref, unref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useMeta, type MetaConfig, type LocaleAwareMeta } from './useMeta'
import { useLocale, type LocaleId } from '../i18n'
import type { RouteMeta, RouteMetaValue } from '../types/route-meta.d'
import type { RouteMetaValue } from '../types/route-meta.d'
/**
* Composable for i18n-aware meta tag management
@ -49,7 +49,7 @@ export function useI18nMeta(
routeValue: typeof route
): T | undefined => {
if (value === undefined) return undefined
return typeof value === 'function' ? value(routeValue) : value
return typeof value === 'function' ? (value as Function)(routeValue) as T : value
}
/**
@ -158,10 +158,10 @@ function resolveI18nCustomTags(
return customTags.map(tag => ({
...tag,
content: typeof tag.content === 'string' && typeof tag.content === 'object'
? resolveI18nContent(tag.content as any, currentLocale) || ''
: typeof tag.content === 'function'
? tag.content
content: typeof tag.content === 'function'
? ''
: typeof tag.content === 'object'
? resolveI18nContent(tag.content as any, currentLocale) || ''
: tag.content
}))
}