Describe the problem
import { resolve } from "$app/paths";
import { page } from "$app/state";
// TypeScript does not know that the params will always match the route id here:
resolve(page.route.id, page.params)
Describe the proposed solution
Would it be possible to let TypeScript know that the params match the route id if we put params inside route? So instead of having page.route.id be any RouteId and page.params be any Params, page.route would be something like
type Route =
| { id: "/"; params: never }
| { id: "/admin/[id]"; params: { id: string } }
| { id: "/[locale=locale]/test"; params: { locale: "en" | "nb" } };
Then I think TypeScript would be able to know that params match id, and would not complain on resolve(page.route.id, page.route.params).
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
Describe the problem
Describe the proposed solution
Would it be possible to let TypeScript know that the params match the route id if we put
paramsinsideroute? So instead of havingpage.route.idbe anyRouteIdandpage.paramsbe anyParams,page.routewould be something likeThen I think TypeScript would be able to know that
paramsmatchid, and would not complain onresolve(page.route.id, page.route.params).Alternatives considered
No response
Importance
nice to have
Additional Information
No response