Skip to content

v1.1.0

Compare
Choose a tag to compare
@sachinraja sachinraja released this 03 Jun 15:24
· 57 commits to main since this release
a3cee7a

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
)