Skip to content

fix(emotion): handle trailing comma in styled(Component,)(styles)#32

Open
giggo1604 wants to merge 1 commit intorolldown:mainfrom
giggo1604:fix/emotion-styled-trailing-comma
Open

fix(emotion): handle trailing comma in styled(Component,)(styles)#32
giggo1604 wants to merge 1 commit intorolldown:mainfrom
giggo1604:fix/emotion-styled-trailing-comma

Conversation

@giggo1604
Copy link

When styled() receives a single argument with a trailing comma (common in .tsx files to disambiguate generics from JSX), the plugin injected ', {' without checking for the existing comma, producing invalid JS with a double comma.

Use checkTrailingCommaExistence()/maybeComma() before inserting the { target, label } object, consistent with all other injection sites.

When styled() receives a single argument with a trailing comma (common in
.tsx files to disambiguate generics from JSX), the plugin injected ', {'
without checking for the existing comma, producing invalid JS with a
double comma.

Use checkTrailingCommaExistence()/maybeComma() before inserting the
{ target, label } object, consistent with all other injection sites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant