Skip to content

Typed routes out of the box (without file based routing) #2494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ThomasKientz opened this issue Apr 21, 2025 · 0 comments
Open

Typed routes out of the box (without file based routing) #2494

ThomasKientz opened this issue Apr 21, 2025 · 0 comments

Comments

@ThomasKientz
Copy link

What problem is this solving

Navigate to an unknown route isn't catch by typescript.

export const router = createRouter({
  routes: [
    { path: "/foo", component: () => import("./pages/foo.vue") },
  ],
  history: createWebHistory(),
});

router.push("/bar"); // <------ No type error

Proposed solution

Infer types so router is strongly typed with declared routes.

Describe alternatives you've considered

unplugin-vue-router but its file based routing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant