nodeTemplateMap in typescript

I have an issue with adding a nodeTemplateMap in typescript:

the code is :
let nodeTemplateMap: any = new go.Map(‘string’, go.Node);
nodeTemplateMap.add(‘serviceDevice’, this.nodeTemplate());
nodeTemplateMap.add(’’, this.nodeTemplate());
myDiagram.nodeTemplateMap = nodeTemplateMap;

the error I get is : is not a function.

any ideas?

I would not declare : any on your variable.

What is the value returned by this.nodeTemplate()

if I don’t add :any, I get Type ‘Map<{},{}>’ is not assignable to type 'Map<string, Part>

this is another code that I copied from javascript where it was working and in TS I get the error

as for the template - it’s just a panel with a text block inside

I suspect that the problem is that the value of this.nodeTemplate() is a plain Panel but should be a Node.

spot on!!!

so I just add a node around it?

That depends on what you want the node to look like. Maybe it’s as simple as replacing go.Panel with go.Node.

thank you so much, works perfectly now.
great to see a product with such a good service.