T
tRPC

procedure.input(z.object) is inferred as a partial (optional fields)?

procedure.input(z.object) is inferred as a partial (optional fields)?

Mmedv9/22/2023
Have a strange case of my input types coming through as partial in procedures, cannot replicate in trpc.io sandbox, any ideas why this might be happening? If I make it a simple input(z.string()) it is of type string, but z.object() properties come through as optional:
No description
Solution:
Found the answer, this is an issue with tsconfig missing strict: true. Mine was set to strict, but apparently my nx integrated repo was not parsing the chain of extended configs correctly, so this small issue was just a symptom of a larger one. Zod just validated my environment 🤔
Jump to solution
No description
Mmedv9/22/2023
trpc.io sandbox as expected is not optional:
Mmedv9/22/2023
No description
Solution
Mmedv9/22/2023
Found the answer, this is an issue with tsconfig missing strict: true. Mine was set to strict, but apparently my nx integrated repo was not parsing the chain of extended configs correctly, so this small issue was just a symptom of a larger one. Zod just validated my environment 🤔

Looking for more? Join the community!

T
tRPC

procedure.input(z.object) is inferred as a partial (optional fields)?

Join Server