arktypea
arktype17mo ago
PIat

Optional key

Hello! How can I define an array, which is also not required as an optional key? Is this the easiest way? https://discord.com/channels/957797212103016458/957804102685982740/1213198676349026355

// Goal:
{
  steps?: ...[]
}

// This still needs `steps: undefined`
steps: 
  type({
    key: "'first'",
  })
  .or({
    key: "'second'",
  })
  .array()
  .or('undefined')
Was this page helpful?