'How to remove checkboxes from parent rows in Lightning:treeGrid in Aura component and keep them on children rows only

How can I remove the checkboxes on the first column of the TreeGrid for the parent rows and only keep the checkboxes for the children rows? I've read countless articles and the only thing I found so far is setting hide-checkbox-column the attribute to true in the lightning-tree-grid component, but this removes all the checkboxes. Any help is much appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source