Override output schema for certain mutations
Is it possible to overrider output schema's type for certain mutations?
Currently I have a base procedure that has an outputschema as such:
As you can see, data is z.any(). For most mutations I don't need to return the data so that's not a problem. However, I want to return the data with the correct type for some.
The output must have either z.literal("success") or z.literal("error").
I tried to add an extra '.output' but it seems like trpc only allows for one (no chaining to override).
1 Reply
GitHub
feat(server): extending
.output()
s · Issue #5787 · trpc/trpcProvide environment information System: OS: macOS 14.5 CPU: (10) arm64 Apple M1 Max Memory: 56.36 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/nod...