fix: useMeta callable type + remove invalid function body from route-meta.d.ts
This commit is contained in:
parent
0f1bc2258a
commit
8971d0ddf2
2 changed files with 2 additions and 27 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
25
apps/vdn-static/src/types/route-meta.d.ts
vendored
25
apps/vdn-static/src/types/route-meta.d.ts
vendored
|
|
@ -117,28 +117,3 @@ 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue