npm run start:server
npm run start:client
npm run schema:generate
npm run start:remote-client
Take a good look at client.ts
and remote-client.ts
and compare the codes. They are almost identical.
Try to change the server.ts
resolver like this.
const baseRouter = router({
greetings: resolver
.args(
z.object({
name: z.number(),
})
)
.query({
output: z.string(),
resolve: ({ input }) => {
return `Hello, ${input.name}`;
},
}),
});
And take a good look at client.ts
, Typescript should display a type error.
You can also then regenerate the schema for remote-client.ts
to see the same error.
For see changes in runtime, you have to restart the server.ts
, this example does not use something like nodemon
.