Skip to content
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

Wrong routes in the documentation ? #50

Open
Xample opened this issue Apr 15, 2024 · 0 comments
Open

Wrong routes in the documentation ? #50

Xample opened this issue Apr 15, 2024 · 0 comments

Comments

@Xample
Copy link

Xample commented Apr 15, 2024

Hi, regarding this file:

https://github.com/kruschid/typesafe-routes/edit/master/docs/basic-features/parameter-types.md

In many examples we do have

import { createRoutes, oneOf } from "typesafe-routes";

const options = oneOf("movies", "music", "art")

const routes = createRoutes({
  home: ["home", options("category")] // <- wrong
});

routes.render("home", {path: {category: "music"}}); // => "/home/music"
routes.parseParams("home", "/home/art"); // => {category: "art"}

i.e.
home: ["home", options("category")]

this won't compile, it should be

const routes = createRoutes({
    home: { path: ['home', options('category')] },
});

As I found this mistake in many places (in the same file) I was wondering if this is a real error or just a kind of upcomming shorthand for the path that I missed.

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