Type your routes with template literal types
A function that takes string for a route accepts /blgo. A template literal type accepts only shapes you declared.
type Route = `/blog/${string}` | `/tips/${string}` | "/" | "/blog";
function push(route: Route) { ... }It is not a router and it does not validate at runtime. It stops the typo at the call site, which is where the typo happens.
typescript