Trouble casting


#1

I get a bunch of nodes with Z.byTag. They are symbols. I want to access their nodes property. The type seems to be root__mysymbol__sym. I cast with let mySymbolNodes = Z.byTag("mytag") as root__mysymbol__sym[];It seems to work, I can now access the nodes property and subsequently all the nodes from the symbol’s tree. No errors in the editor. Except when I try to run, I get the error message cannot find name root__mysymbol__sym. How do I go about this? I did casting before, usually to Z.Type.Node or Z.Type.Object but this time my nodes are all symbols from the SYMBOL DEFINITIONS panel.


#2

Hey marks,

Maybe you’re looking for something along these lines? Just an example…

let mySymbolNodes : any = Z.byTag("mytag");
mySymbolNodes.forEach((s) => {
    s.nodes.someNode.color([1,1,1,1]);
});

I think the root__stuff is part of the Zappar backend that makes code filling (among other stuff) in the editor work. Most likely disappears when TypeScript is compiled to JS.


#3

The any type solved my problem, thanks.