Skip to content

2.1.0

Latest
Compare
Choose a tag to compare
@zoontek zoontek released this 22 Jul 15:18
0718590
  • Add the InferRoutes utility type
  • Fix Router.push / Router.replace / Router.{RouteName} params argument type when routeName is an union:
const Router = createRouter({
  One: "/:one",
  Two: "/:one/:two",
});

const fn = (name: "One" | "Two") => {
  // previously, '{ one: string }' was valid, as it fulfilled the "One" route params type
  Router.push(name, { one: "1" }); // ❌ not assignable to type '{ one: string; two: string }'.
};