What's not working?
In @redwoodjs/router there is this export:
export interface AvailableRoutes {
[key: string]: (args?: Record<string | number, string | number | boolean>) => string;
}
Which is responsible for almost all of my broken web deploys, because it allows for any possible named function and TypeScript cannot check for whether this is correct - meaning if you ever rename/remove a route then you get a runtime crash and it is not detectable via a build nor type check.
Given that you get a runtime error if it is not the type shape explicitly added in .redwood/types/includes/web-routerRoutes then it should really default to an empty object:
export interface AvailableRoutes {}
How do we reproduce the bug?
Make a typo on the routes object in web
What's your environment? (If it applies)
Are you interested in working on this?
What's not working?
In
@redwoodjs/routerthere is this export:Which is responsible for almost all of my broken web deploys, because it allows for any possible named function and TypeScript cannot check for whether this is correct - meaning if you ever rename/remove a route then you get a runtime crash and it is not detectable via a build nor type check.
Given that you get a runtime error if it is not the type shape explicitly added in
.redwood/types/includes/web-routerRoutesthen it should really default to an empty object:How do we reproduce the bug?
Make a typo on the
routesobject in webWhat's your environment? (If it applies)
Are you interested in working on this?