fix: useMeta callable type + remove invalid function body from route-meta.d.ts

This commit is contained in:
BarnacleBoy 2026-05-18 12:43:58 +00:00
parent 0f1bc2258a
commit 8971d0ddf2
2 changed files with 2 additions and 27 deletions

View file

@ -235,7 +235,7 @@ export function useMeta(
routeValue: RouteLocationNormalizedLoaded
): 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
}
/**

View file

@ -116,29 +116,4 @@ export type RouteMetaValue<T> = T | ((route: RouteLocationNormalizedLoaded) => T
/**
* Helper function type for dynamic meta values
*/
export type MetaValueFunction<T> = (route: RouteLocationNormalizedLoaded) => T
/**
* Type guard for checking if a meta value is a function
*/
export function isMetaFunction<T>(
value: RouteMetaValue<T>
): value is MetaValueFunction<T> {
return typeof value === 'function'
}
/**
* Type for route with extended meta
*/
export interface RouteWithMeta {
meta: RouteMeta
name?: string | symbol
path: string
}
/**
* Type for pages that support meta configuration
*/
export interface PageMetaConfig {
meta?: RouteMeta
}
export type MetaValueFunction<T> = (route: RouteLocationNormalizedLoaded) => T