npm @trpc/client 9.12.0

latest releases: 11.0.0-alpha-tmp-app-router-example.388, 11.0.0-alpha-tmp-app-router-example.387, 11.0.0-rc.402...
2 years ago
  • Add PRECONDITION_FAILED / HTTP 412 error code (#1194)
  • Input schemas defined with zod using the inferred input type (#1189 / #1182)

What #1189 means is that you can now do this code:

trpc.router()
  .query('greeting', {
    input: z.object({
      hi: z.string().transform(s => s.length),
    }),
    resolve({ input }) {
      input.hi // => `number`, as expected
    },
  });

// [...] somewhere else:

client.query('greeting', { hi: 'my greeting' });

Thanks to @mgreenw & @kimroen!

Don't miss a new client release

NewReleases is sending notifications on new releases.