🍿 The ONLY TypeScript validation runtime library you'll need πŸͺ„πŸ’«

Hey friend,

Every developer aspires to climb the career ladder and evolve into a more senior, leadership role. However, many find this progression challenging or don't get to the level they want.

If you are preparing for a senior role or are just a few years away, I have compiled five key strategies that every developer must pursue to reach seniority.

If you prefer watching a video, then check out this video!

​The REAL reason you’re not a Senior Engineer πŸ‘‡

video preview​

Don't forget to subscribe to my Youtube channel! if you haven't already!
​

Weekly Snack: Zod Schema Validation 🍿

​Zod provides TypeScript first schema validation.

It allows you to check types at the runtime level as well at the type level. It's easier to validate your schema and complex data structures.

z is an instance of the "zod" library, and z.object() is used to define a schema for an object.

We create a validation schema for an object with "name" and "amount" fields. It then attempts to validate an object (likely received from a form submission) against this schema.

  • The "name" field should be a non-empty string.
  • The "amount" field should be a number greater than 0.

The safeParse method does the following:

If the validation is successful, the result object will have a success property set to true and the parsed data.

If validation fails, it will have success set to false, and there might be an error property with details about the failure.

To check out the power of Zod, check out this advanced example of Zod:

twitter profile avatar
{PuruVijay}.svelte
Twitter Logo
@puruvjdev
2:11 AM β€’ Nov 3, 2023
212
Retweets
2520
Likes
​

​
The Frontend Developers Toolbox 🧰

That's all for today; keep learning and growing!
​


Was this useful? With your feedback, I can improve future emails. Click on a link to vote:

​πŸ”₯ Loved it​

β€‹πŸ˜ Not bad​

β€‹πŸ‘Ž You can make it better​

I hope you have a great day!

P.S.

A Frontend Newsletter that you'll love! πŸ’–