Getting list of component property combinations

From an instance node, I’m trying to move up the tree up to the componentSetNode, then to each componentNode so I can grab every valid combination of component properties (sometimes components have unused combinations).
When I run . componentPropertyReferences on the componentNode, I’m getting an empty object back.

Is there another way to tackle this?

Here is how the componentPropertyReferences property is described in the documentation:

All component properties that are attached on this node. A node can only have componentPropertyReferences if it is a component sublayer or an instance sublayer. It will be null otherwise. The value in the key-value pair refers to the component property name as returned by componentPropertyDefinitions on the containing component, component set or main component (for instances).

Therefore, to get the componentPropertyReferences, you need to traverse the tree of children, its children’s children, etc.

Traversing the tree doesn’t show anything under componentPropertyReferences for components under a componentSet. And componentPropertyDefinitions isn’t what I’m looking for.

Have you traversed the children tree inside the ComponentNode?

Yes I have, i went from instance → componentNode → componentSetNode → componentNode

InstanceNode.mainComponent.parent.children[0].children[0] // etc.

Why would I go through each element inside a component node? Thats extremely inefficient.

Only there you can get a non-null componentPropertyReferences. I wrote about this from the very beginning.