compiled icon indicating copy to clipboard operation
compiled copied to clipboard

Conditional rules don't generate valid CSS output when deconstructed props have same name as shadowed variables

Open pancaspe87 opened this issue 2 years ago • 0 comments

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

image

It is worth checking if the issue is still occurring after fixing #1086

pancaspe87 avatar Apr 07 '22 01:04 pancaspe87