*
* @param to - Route location to navigate to
*/
- push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>
+ // push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>
/**
* Programmatically navigate to a new URL by pushing an entry in the history
* stack.
*
* @param to - typed route location
*/
- push<T extends keyof NamedLocationMap>(
- to: RouteNamedLocation<T>
+ push(
+ to: RouteNamedLocation
): Promise<NavigationFailure | void | undefined>
/**
}
export interface NamedLocationMap {}
-export interface RouteNamedLocation<T extends keyof NamedLocationMap>
- extends RouteLocationOptions {
+export interface RouteNamedLocation<
+ T extends keyof NamedLocationMap = keyof NamedLocationMap
+> extends RouteLocationOptions {
name: T
- params: NamedLocationMap[T]
+ // params: NamedLocationMap[T]
}
declare const r: [
-import { defineRoutes } from './index'
+// NOTE `ExtractNamedRoutes` is not exposed on build, you might need to add export to the type manually
+
+import { ExtractNamedRoutes, Router } from './index'
import { DefineComponent } from 'vue'
declare const Comp: DefineComponent
-const routes = defineRoutes([
+const routes = [
{
path: 'my-path',
name: 'test',
// path: 'my-path',
// component: Comp,
// } as const,
-])
+]
+
+type TypedRoutes = ExtractNamedRoutes<typeof routes>
declare module './index' {
- interface RouteMeta {
- requiresAuth?: boolean
- nested: { foo: string }
- }
+ interface NamedLocationMap extends TypedRoutes {}
}
+
+declare const router: Router
+
+router.push({
+ name: '',
+})