Closed dddlr closed 8 months ago
Latest commit: c3b3baccb14fab20fdecd6c2271d6e95f17ca4e4
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Fixes #1629
https://github.com/atlassian-labs/compiled/blob/9860df3850ac5023ffa93201f5648fd7c81807c5/packages/babel-plugin/src/utils/build-styled-component.ts#L80 expects a MemberExpression in order to detect what props shouldn't be forwarded to React. All other props are forwarded to React. (see this PR for more context: https://github.com/atlassian-labs/compiled/pull/1273)
However, when we handle default values in situations like these...
@compiled/babel-plugin
used thet.identifier
function to generate the__cmplp.marginTop
expression:The above appears correct, because the build output is identical and Babel doesn't stop us from passing invalid expressions to the
t.identifier
function... however, the use oft.identifier
andt.memberExpression
meant that it would never get detected as a MemberExpression, and thus the prop would never not be forwarded to React :(This PR fixes this by replacing
t.identifier
witht.memberExpression
.