Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing a css output as a value to another css call fails with no type error (etc) #1647

Open
kylorhall-atlassian opened this issue Mar 12, 2024 · 0 comments

Comments

@kylorhall-atlassian
Copy link
Collaborator

Describe the bug

The pattern of passing a css output to a value in another css does not work in Compiled, but it also does not fail type-checking. There only way to determine this doesn't work is by trying it. This could be problematic in migration from another CSS-in-JS library primarily.

const styles1 = css({ color: 'red' });
const styles2 = css({ '&:hover': styles1 });

I did not test this with styled.div({ '&:hover': styles1 });, but I expect it might not work as well. It does not throw a type error.

To Reproduce

[tested in a local Storybook, I have no codesandbox or anything, sorry]

Expected behavior

This works in Emotion and almost certainly in the tagged template expression interpolations in Compiled, but I'd vote that we don't want to support it in Compiled, and instead should just have a type error.

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

No branches or pull requests

1 participant