AG grid dynamic expand collapse icons

I am trying to use custom icons for expanded and collapsed icons in an AG grid. I can set them in grid_options like the following and it works.

"icons": {
        'groupContracted': '<i class="fa fa-shower"/>',
        'groupExpanded': '<i class="fa fa-long-arrow-alt-up"/>',
    },

However, if I want to have a icon based on a conditions, like the following, the grid does not load at all and seems to freeze.

“icons”: {
‘groupContracted’: {“function”: “”"
params.data.id===1 ? ‘’ : ‘
“”"},
‘groupExpanded’: ‘’,
},

Is there a way to achieve this