transform
method, Zod will infer the type from the return value of the transform
method. If you need the type definition before transformation, you’ll need to define your schema outside of createRegistration
or createDependency
.
__typename
?__typename
, you’ll need to define a fragmentName
for each fragment. This is to avoid conflicts when collecting fragments for a query.
union
using multiple fragments?Fragment
to the __typename
, that can add quite a bit of bytes to your query.
transform
functions have access to server context?transform
functions. For this you’ll need to set up a “store” to hold this information.
In the below example is for Next.js utilising the React cache
function.
page.tsx
or layout.tsx
you can set the pathname
and access it in your transform
functions.
params
are available.