diagram.copyParts is changing data object type

We’ve a functionality of copying and pasting a subtree in our tree module. The implementation is done using JavaScript.
While copying, we are gathering the selected node’s child items and storing in a Set.
Then we are copying to the clipboard using

var subTreeItems = _fetchSubTree(); // copying all the children of selected node
this.diagram.commandHandler.copyToClipboard(subTreeItems);
var copiedItems= this.diagram.copyParts(subTreeItems , null, false);

This copiedItems we are using while pasting.

When we used GoJs 1.8, the node’s .data object coming of type ctor
but after updating the library to 2.x, the node’s .data object coming with the type constructor

This is breaking our paste functionality.
Is there any way to get the data as ctor type.

While debugging the source, found below block which is reassigning the data object with the constructor type.

If you set CommandHandler.copiesTree to true, copy and paste will copy subtrees automatically, so you don’t need to bother with your code.

The code was reimplemented from JavaScript to TypeScript between v1.8 and v2.0, but if you ignore the type declarations the code is basically the same.

I don’t know what you mean by ctor and constructor