* Component to display when the URL matches this route.
*/
component: RawRouteComponent
+ components?: never
/**
* Allow passing down params as props to the component rendered by `router-view`.
*/
* Components to display when the URL matches this route. Allow using named views.
*/
components: Record<string, RawRouteComponent>
+ component?: never
/**
* Allow passing down params as props to the component rendered by
* `router-view`. Should be an object with the same keys as `components` or a
}
/**
- * Route Record that defines a redirect. Cannot have `component`, `components` or
- * `children` as it is never rendered.
+ * Route Record that defines a redirect. Cannot have `component` or `components`
+ * as it is never rendered.
*/
export interface RouteRecordRedirect extends _RouteRecordBase {
redirect: RouteRecordRedirectOption
component?: never
components?: never
- children?: never
}
export type RouteRecordRaw =
--- /dev/null
+import { RouteRecordRaw } from './index'
+import { defineComponent } from 'vue'
+
+const component = defineComponent({})
+const components = { default: component }
+
+const routes: RouteRecordRaw[] = []
+
+routes.push({ path: '/', redirect: '/foo' })
+
+// @ts-expect-error cannot have components and component at the same time
+routes.push({ path: '/', components, component })
+
+routes.push({
+ path: '/',
+ redirect: '/foo',
+ children: [],
+})
+
+routes.push({ path: '/', component, props: true })
+routes.push({ path: '/', component, props: to => to.params.id })
+// @ts-expect-error: props should be an object
+routes.push({ path: '/', components, props: to => to.params.id })
+routes.push({ path: '/', components, props: { default: to => to.params.id } })
+routes.push({ path: '/', components, props: true })
+
+// let r: RouteRecordRaw = {
+// path: '/',
+// component,
+// components,
+// }