atlassian-labs / compiled

A familiar and performant compile time CSS-in-JS library for React.
https://compiledcssinjs.com
Apache License 2.0
1.99k stars 67 forks source link

Brittle css prop array composition #892

Open madeleineostoja opened 3 years ago

madeleineostoja commented 3 years ago

Describe the bug The css prop array composition fails in unexpected ways when using anything but simple variables or strings. The following throws exceptions at compile time:

// Error: MemberExpression isn't a supported CSS type
css={[ mixins.mixin, css``} 
// Error: SpreadElement isn't a supported CSS type
css={[ ...mixins, css``]}

To Reproduce

1) Try compose different types of data structures that should intuitively work in an array 2) Watch it throw errors about unsupported types

Expected behavior Array composition should behave like a normal Array and support things like spreads, etc.

Desktop (please complete the following information):

madeleineostoja commented 3 years ago

Looking at this more it might be a bug? I'm also getting

TemplateLiteralExpression isn't a supported CSS type when I just try to use css={css