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

Types on css={…} don't block using the top-level object from cssMap() #1642

Open
kylorhall-atlassian opened this issue Mar 6, 2024 · 1 comment
Labels
bug 🐛 Something isn't working chore 🧹 It's something tedious

Comments

@kylorhall-atlassian
Copy link
Collaborator

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:

const { getByTestId } = render(<div css={styles.primary} data-testid="div" />);

Expected behavior

These should both have a type error.

Screenshots

No error 😞
Screenshot 2024-03-07 at 11 53 13 AM

@itsdouges itsdouges added bug 🐛 Something isn't working chore 🧹 It's something tedious labels Mar 6, 2024
@itsdouges
Copy link
Collaborator

Thanks for raising this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working chore 🧹 It's something tedious
Projects
None yet
Development

No branches or pull requests

2 participants