I'm trying to change the value of a hierarchy slicer using powerbi-client and setSlicerState, but the function setSlicerState only takes an object of type ISlicerState as input. However, for hierarchy slicer we need to pass an object using this format:
const filter =
{
$schema: 'http://powerbi.com/product/schema#hierarchy',
filterType: 9,
target,
hierarchyData
}
This format doesn't respect the interface ISlicerState so how can I achieve what I want to do?
I used the documentation at https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/control-report-slicers#hierarchy-filter
However, it looks like this documentation is wrong since I did exactly what they said, but it's not working:

Even if they do it in the doc:
