v1.1.0
z.describe()
/ descriptions are now supported for object properties:
example input:
const schema = z.object({
num: z.number().describe('a number')
})
output before update:
{
num: number
}
output after update:
{
/** a number */ num: number
}
Additionally, you can now add comments in createTypeAlias
too:
const schema = z.object({
name: z.string()
price: z.number()
}).describe('an item')
const typeAlias = createTypeAlias(
schema,
'Item',
// can optionally pass a comment here
// this example just passes the description from the zod schema - 'an item'
schema.description
)