arktypea
arktype16mo ago
PIat

Extracting intent into runtime

Hello!

What is the canon way to extract keys from types like these:

const type1 = type({
  intent: '"hello"',
 })

const type2 = type({
  intent: '"hello"',
}).or({
  intent: '"bye"',
})


In a way that the resulting object is
{
  intent: {
    hello: 'hello'
  }
}

{
  intent: {
    hello: 'hello',
    bye: 'bye'
  }
}

?

Would it be achieved with
internal.distribute
?
Was this page helpful?