Design comparison
Solution retrospective
Hello everyone, I'm excited to share my first Typescript challenge with you! As someone relatively new to Typescript, I would really appreciate any feedback you can provide on how I've approached typing in my code. This challenge was a great opportunity for me to learn and apply Zod for the first time, which was super helpful. Thank you in advance for your time and insights!
Community feedback
- @TripouillePosted over 1 year ago
Hello Geoffrey,
Congratulations on your work! Here's some feedback on your usage of TypeScript.
Avoid using 'any' unless for advanced stuff like generic: It's recommended to minimize the use of 'any' in TypeScript, as it can weaken the type safety benefits of using TypeScript. Instead, try to explicitly define the types of your variables, parameters, and return values to make your code more robust and maintainable.
Provide function signatures: When typing a function, it's important to provide a function signature, especially when using 'setState' from React. This helps with type inference and makes it easier for other developers to understand the expected input and output types of the function.
Consider using form validation libraries: If you're working with form validation using Zod, you might want to consider pairing it with a form validation library like React Hook Form. This can provide additional functionality and make it easier to manage form state and validation in a scalable and efficient way.
Overall, great job! I hope this feedback is helpful in improving your usage of TypeScript. Keep up the good work!
Marked as helpful1@geoffreyhachPosted over 1 year ago@Tripouille Thanks a lot for taking the time to read my code and to give me this feedback.
- I changed the last "any" type in my last commit, I just forgot to push it!
- I'm gonna dig into the subject of functions' signature
- I didn't use form validation library on purpose to work a bit on my basis. I'm familiar with React Hook Form, and I love it. That's also why I didn't use any CSS framework. I tend to rely too much on MUI those days.
Thanks again for your time and feedback!
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord