compiled
compiled copied to clipboard
Conditional rules don't generate valid CSS output when deconstructed props have same name as shadowed variables
Describe the bug An unhandled exception is raised when parsing the scenario given in #1086 .
const isPrimary = true;
const Component = styled.div<TextProps>`
color: ${({ isPrimary }) => (isPrimary ? 'green' : 'red')};
font-weight: ${() => (isPrimary ? 'bold' : undefined)};
`;
The example didn't throw any error at the time it was provided. It is suspected that this might have been broken with recent changes to the way we handle conditional rules.
The error seem to happen when there are at least 2 conditional rules with the same deconstructed props
It is worth checking if the issue is still occurring after fixing #1086