Zod Section 10 exercises
solution

# Update the toString Functionself.__wrap_balancer=(t,e,n)=>{n=n||document.querySelector(`[data-br="\${t}"]`);let o=n.parentElement,r=E=>n.style.maxWidth=E+"px";n.style.maxWidth="";let i=o.clientWidth,s=o.clientHeight,c=i/2,u=i,d;if(i){for(;c+1<u;)d=~~((c+u)/2),r(d),o.clientHeight==s?u=d:c=d;r(u*e+i*(1-e))}};self.__wrap_balancer(":Rhd9r6:",1)

## Create a `numberParser`

Parsers are one of the most basic features of Zod.

To start our solution, we'll create a `numberParser` by invoking `z.number()`.

This creates something called `z.ZodNumber` that provides several helpful methods.

`const numberParser = z.number();`

Pass

The solution here is to use the very, very basic stuff that Zod gives you, which is, first of all, we're going to create a numberParser. This numberParser is going to be invoked from `z.number`. This creates something called `z.ZodNumber`.
0:16 We can use numberParser in a bunch of ways. We can go .parse. We can pass in some random data. It will error if it's not a number. Anything that we return from this, as you can see,` numberParser.parse(num),` this is now typed as a number. If we wanted to accept a Boolean instead, then we would go z.boolean. Now this would be typed as a Boolean.
1:10 They represent the basic elements of TypeScript too. You've got Boolean. You've got string. You've got number. You've got bigint and null and undefined. You can even have `z.undefined`, `z.null`. What you'll start to see about Zod is that it mimics a lot of what you're used to in TypeScript with its runtime type system.