atlassian-labs / compiled

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

Fix 'as const' expressions causing build error #1670

Closed dddlr closed 3 months ago

dddlr commented 3 months ago

The as const in the following code currently causes a build error in @compiled/babel-plugin:

import { css } from '@compiled/react';

const something = { large: '@media screen' } as const;
const styles = css({ [something.large]: { color: 'blue' } });

This is a problem because media from @atlaskit/primitives/responsive uses as const extensively. We would like to unblock people from using @atlaskit/primitives/responsive in their Compiled code when the @atlaskit/primitives/responsive TypeScript source code is being consumed directly in a project (local consumption).

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: c6a59d54568ab04be50cce18bf4d21c21571f605

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------------- | ----- | | @compiled/babel-plugin | Patch |

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