mm-ninja-turtles / turtle-express

My attempt of making Express.JS a typesafe router with Zod.
3 stars 0 forks source link

[feature]: typescript not working well with zod array validation #52

Closed PyaePhyoKyaw61194 closed 2 years ago

PyaePhyoKyaw61194 commented 2 years ago

I have to use zod array validation to return users. In this case, typescript cannot show error for resolver.

Screenshot 2022-08-21 at 03 52 41
PyaePhyoKyaw61194 commented 2 years ago

As for comparison , I added the simple object validation for 400 message. In this case, typescript works

Screenshot 2022-08-21 at 03 53 41
PyaePhyoKyaw61194 commented 2 years ago

Even though the typescript does not work well, our lib can still detect the error when a req is sent. The validation error is caught when the name property is not included in resolver return type.

wai-lin commented 2 years ago

55

wai-lin commented 2 years ago

@PyaePhyoKyaw61194 this should be solved since v0.2.0 is this solved for you?

PyaePhyoKyaw61194 commented 2 years ago

@wai-lin yep, we can close this.