fontawesome.macro icon indicating copy to clipboard operation
fontawesome.macro copied to clipboard

MacroError: Only string literals are supported when referencing icons (use a string here instead)

Open dance-cmdr opened this issue 1 year ago • 3 comments

I understand that this might be a Typescript issue rather than a macro issue, but I wonder if you could be of help.

I'm trying to make a basic utility to conditionally render "chevron-up" OR "chevron-down".

Doing this...

const chevronIconName: IconName = isExpanded ? "chevron-up" : "chevron-down";
const chevronIcon = solid(chevronIconName) ;

Throws this error and of course it breaks the webpack build.

MacroError: Only string literals are supported when referencing icons (use a string here instead)

dance-cmdr avatar Oct 05 '22 17:10 dance-cmdr