Releases: swan-io/chicane
Releases · swan-io/chicane
2.1.0
- Add the
InferRoutes
utility type - Fix
Router.push
/Router.replace
/Router.{RouteName}
params
argument type whenrouteName
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 }'.
};
2.0.0
1.4.1
1.4.0
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
- Add support for search and hash params on wildcard routes (
/*
).
This allow some neat tricks, like using a search param from a whole app area:
export const Router = createRouter({
Home: "/",
...createGroup("User", "/users?:impersonatedId", {
Area: "/*", // UserArea: "/users/*?:impersonatedId" -> You can get impersonatedId value at area root
Detail: "/:userId", // UserDetail: "/users/:userId?:impersonatedId" -> as it's a group, each route accept impersonatedId param
}),
});