Nested objects and union types in yjs

Hi all,
I have an object I want to sync that has the following definition
myObject = {
arg1: boolean,
arg2: Object
}

and arg2 = {
key1 : boolean or Typescript record
key2 : boolean or Typescript record
}

now I want to know how can I make myObject as a yMap with the double nested type (object of object) inside it and also how to achieve the typescript union type in yjs (expect boolean or record)

You would model objects/records as Y.Maps:

const myObject = new Y.Map<{
  arg1: boolean,
  arg2: Y.Map<{
    key1: boolean | Record<'prop1' | 'prop2' | 'prop3', string>
    key2: boolean | Record<'prop1' | 'prop2' | 'prop3', string>
  }>
}>()