Trouble casting

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.

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.

1 Like

The any type solved my problem, thanks.

Is there a way to cast to a sub-symbol without using any? any works but is not ideal.