Route

Client-side Types

We can use our routes with @webroute/client by using the ToClient helper.

This will enable us to easily transform a record of routes into a type-safe client.

import { ToClient } from "@webroute/route"
 
// Export to monorepo or npm, perhaps...
export type AppDef = ToClient.InferApp<typeof appRoutes>;

We can then import this AppDef on the client side and use it with @webroute/client.

const client = createTypedClient<App>()({
	/**...*/
})

Learn more about Client.

On this page

No Headings