fix(nuxt): type useRoute return (#6395)

This commit is contained in:
Daniel Roe 2022-08-07 05:57:11 +01:00 committed by GitHub
parent 58abefc326
commit 4623525f3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,16 +8,16 @@ export const useRouter = () => {
return useNuxtApp()?.$router as Router
}
export const useRoute = () => {
export const useRoute = (): RouteLocationNormalizedLoaded => {
if (getCurrentInstance()) {
return inject<RouteLocationNormalizedLoaded>('_route', useNuxtApp()._route)
return inject('_route', useNuxtApp()._route)
}
return useNuxtApp()._route
}
/** @deprecated Use `useRoute` instead. */
export const useActiveRoute = () => {
return useNuxtApp()._route as RouteLocationNormalizedLoaded
export const useActiveRoute = (): RouteLocationNormalizedLoaded => {
return useNuxtApp()._route
}
export interface RouteMiddleware {