Can't set ymap inside another ymap

I know that I can set yMap inside yMap like this

import * as Y from 'yjs'

const ydoc = new Y.Doc()
const ymap = ydoc.getMap('my map type') 
const ymapNested = new Y.Map()

ymap.set('my nested map', ymapNested)

But when I try to set it by first creating another doc and getting map from there, the same method doesn’t work.

import * as Y from 'yjs'

const ydoc = new Y.Doc()
const ydoc2 = new Y.Doc()
const ymap = ydoc.getMap('my map type') 
const ymapNested = ydoc2.getMap('nested map') 

ymap.set('my nested map', ymapNested)

It throws the following error TypeError: Cannot read properties of null (reading 'forEach')

The reason I want to do this way, because in the API’s that I work on, there may be several YDocs for each of the datatype created. I’m trying to cover the case when two yMaps with different YDocs can be linked, so that I can observe the changes using yMap.observe.

Is this method not supported because of different YDocs, is there any other way to link this two YDocs/YMaps?

You can’t insert an already integrated type into a document. Please have a look at the shared-types tutorial: Shared Types - Yjs Docs