compiled
compiled copied to clipboard
Types on `css={…}` don't block using the top-level object from `cssMap()`
Describe the bug
There's no type protection when consuming cssMap incorrectly, meaning TypeScript will allow code that won't compile properly.
To Reproduce
For raw cssMap, jump into https://github.com/atlassian-labs/compiled/blob/master/packages/react/src/css-map/tests/index.test.tsx#L29 and remove .danger
-const Foo = () => <div css={styles.danger}>hello world</div>;
+const Foo = () => <div css={styles}>hello world</div>;
Same, for the strict version: https://github.com/atlassian-labs/compiled/blob/f093635244ca5accecd5093013694084408be2f7/packages/react/src/create-strict-api/tests/index.test.tsx#L162
Expected behavior
These should both have a type error.
Screenshots
No error 😞
Thanks for raising this!