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

Fix params type when the route name is an union #50

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

zoontek
Copy link
Contributor

@zoontek zoontek commented Jul 22, 2024

Let's suppose you have this router:

export const Router = createRouter({
  Home: "/",
  ProjectRoot: "/projects/:projectId",

  DevelopersApi:
    "/projects/:projectId/:projectEnv{live|sandbox}/developers/api",
});

const doSomething = (name: "ProjectRoot" | "DevelopersApi") => {
  Router.push(name, { projectId: "" }); // no error before, now there's one
};

Before, there was no error. The route name could be either ProjectRoot or DevelopersApi, but the params was not an intersection or both those route params.

@zoontek zoontek requested review from bloodyowl and sandrine-ds July 22, 2024 13:31
@zoontek zoontek merged commit f334dfd into main Jul 22, 2024
1 check passed
@zoontek zoontek deleted the fix-route-union-params branch July 22, 2024 14:26
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

Successfully merging this pull request may close these issues.

1 participant