You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working on creating a generic function that takes a Zod schema as an argument and parses only a specified property. I came up with the following implementations, and both work as expected.
However, I noticed that there are two different ways to specify the type annotations. I’m unsure which one is better or if there’s an even more optimal way to write this. I would appreciate any advice you could provide.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I’m working on creating a generic function that takes a Zod schema as an argument and parses only a specified property. I came up with the following implementations, and both work as expected.
However, I noticed that there are two different ways to specify the type annotations. I’m unsure which one is better or if there’s an even more optimal way to write this. I would appreciate any advice you could provide.
Which of these type annotations is preferable, or is there a better way to achieve this functionality?
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions