Skip to content

Commit

Permalink
feat: allow extending the type of definePage()
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 16, 2023
1 parent a39afae commit 4d663b1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export { stopScope as _stopDataFetchingScope } from './data-fetching/dataCache'
*
* @param route - route information to be added to this page
*/
export const _definePage = (
route: Partial<Omit<RouteRecordRaw, 'children' | 'components' | 'component'>>
) => route
export const _definePage = (route: DefinePage) => route

/**
* Merges route records.
Expand Down Expand Up @@ -50,3 +48,11 @@ export function _mergeRouteRecord(
return acc
}, main)
}

/**
* Type to define a page. Can be augmented to add custom properties.
*/
export interface DefinePage
extends Partial<
Omit<RouteRecordRaw, 'children' | 'components' | 'component'>
> {}

0 comments on commit 4d663b1

Please sign in to comment.