Converting Prosemirror doc to plain-text

I’m trying to convert the prosemirror object to plain-text by extracting content parts on each level. However, when I use getter textContent, it doesn’t work and returns undefined. What method should I use to receive only content in a string (with separators would be better)?

I do so

    const transformer = new Transform(node)
    const content = transformer.doc.textContent.toString()

textContent should definitely not return undefined. To get more control over separators you can use textBetween.

I put to the Transformer contructor Json data, maybe it’s not right. Because when i use other getters e.g. size, isText or text all of them is undefined. Can you show how to use transform right?