trpc / v10-playground

tRPC v10 procedure play
https://stackblitz.com/github/trpc/v10-playground?file=src%2Fserver%2Findex.ts,src%2Fclient.ts,src%2Fserver%2Frouters%2FpostRouter.ts&view=editor
13 stars 3 forks source link

Double model definition #9

Closed iceydee closed 2 years ago

iceydee commented 2 years ago

https://github.com/trpc/v10-playground/blob/b3e2372b62679353dfdcad8a7e69040f6ede0f94/src/server.ts#L62-L65

Why do I need to define the input model twice? It's already in the zod part. Feels like "cake on cake".

KATT commented 2 years ago

the expectTypeOf() is only for asserting that the inference is doing what it's intended to. More clear now that I moved it to another file called .test.ts? https://github.com/trpc/v10-playground/blob/c104f0890eab49a19ff7f1d638c6a199c1a9eb0e/src/server.test.ts#L53-L60