How to check if user belongs to a sharepoint AD group nested within a SPO group using REST/Javascript only?

I need to know if a user belongs to a specific SPO group using REST/Javascript. If the user has been added individually I can but if the user has been added to that SPO group via an AD group I can’t because rest APIs return the AD group as user hiding all its members.

I can’t use the workaround described here because I need that everyone could view group membership.

Any suggestion will be highly appreciated.