Am I supposed to handle type-related errors on client side? (TRPC)

I'm using react-hook-forms, I'm just getting the data which I mostly assign to (string) as it'll get validated anyways on the server but the LSP keeps nagging that I have to validate the form before submitting it isn't it supposed to be server-side and that's it? What do you guys usually do in such case? // @ts-ignore and keep moving or actually fix it?
No description
3 Replies
erik.gh
erik.gh15mo ago
why don’t you just also validate the user input on the front end that way you can provide faster feedback and avoid unnecessary requests to your server you can even reuse your schema to make sure both front and back end always align with what is expected
erik.gh
erik.gh15mo ago
i use this (typical) approach: https://github.com/react-hook-form/resolvers
GitHub
GitHub - react-hook-form/resolvers: 📋 Validation resolvers: Yup, Zo...
📋 Validation resolvers: Yup, Zod, AJV, Joi, Superstruct, Vest, class-validator, io-ts, typanion, Ajv, TypeBox, Valibot and nope. - GitHub - react-hook-form/resolvers: 📋 Validation resolvers: Yup, Z...
West side ⁉
West side ⁉OP15mo ago
yeah I looked it up and thought of it I think this is what I'm gonna end up with t3 should ship with it tbh
Want results from more Discord servers?
Add your server