-
Notifications
You must be signed in to change notification settings - Fork 24
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
Queries in emotion css blocks have broken types #971
Comments
Or maybe I just don't understand emotion's API 🤷♂️ ... I made it work by explicitly passing props from the outer scope, which I assumed would be done automatically for string interpolations within import { css } from "@emotion/react";
import { down } from "styled-breakpoints";
const myReusableCss = (props) => css`
${down("xs")(props)}{
background: red;
}
` |
@filipnathanel, hello. Thank you so much for discovering this issue. Yes, this is indeed a type bug. Since the css type from styled-components is not compatible with the type from @ emotion / styled. I'll be working on fixing this issue shortly.) |
@filipnathanel Why are you using |
I don't know how As per emotion docs: |
## [10.0.1](v10.0.0...v10.0.1) (2021-05-27) ### Bug Fixes * fix type conflict in `@emotion/react` [[#971](https://github.com/mg901/styled-breakpoints/issues/971)](https://github.com/mg901/styled-breakpoints/issues/971) ([b432588](b432588))
@filipnathanel, now everything all right.)) Update styled-breakpoints to 10.0.1 |
@filipnathanel did I manage to solve your problem? |
@mg901 Thanks for keeping me in the loop. The type error is no longer present however the breakpoint still doesn't work without props being explicitly passed to the breakpoint. I have updated the code sandbox with I think it has something to do with this issue emotion-js/emotion#1085 |
@filipnathanel In the near future I will investigate this issue and try to solve your problem. |
@@filipnathanel, sorry for long answering you for a long time. I have researched the given question. The css function in @ react / emotion doesn't know anything from the theme, unlike styled-components. For this reason, you need to make atomic mixins that know nothing about breakpoints. In this issue describes a similar problem. If you have any problems in solving your problems, turn around. I am always happy to help you.) |
@filipnathanel, bro I was able to help you in solving the problem? |
Hi Maxim!
First of all: many thanks for such a great library :)
I am writing as I have stumbled upon a potential bug that relates to Typescript.
the following line of code will result in a Type Error
you can check the reproduction in a Code Sandbox:
https://codesandbox.io/s/stupefied-hertz-0z2b6?file=/src/MyComponent.ts
I might take a deeper look into code later on in the week to see whether I could come up with a solution.
The text was updated successfully, but these errors were encountered: