Queries in emotion css blocks have broken types
See original GitHub issueHi 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
import { css } from "@emotion/react";
import { down } from "styled-breakpoints";
const myReusableCss = css`
${down("xs")}{
background: red;
}
`
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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Media Queries - Emotion
Using media queries in emotion works just like using media queries in regular css except you don't have to specify a selector inside...
Read more >Why We're Breaking Up with CSS-in-JS - DEV Community
Hi, I'm Sam — software engineer at Spot and the 2nd most active maintainer of Emotion, a widely-popular CSS-in-JS library for React.
Read more >media query display block not working in @emotion/react
I have a style like this. //inside page.jsx export function Page() { return ( <div css={container}> <div css={header}> <div ...
Read more >styled-breakpoints | Yarn - Package Manager
Simple and powerfull css breakpoints for styled-components and emotion. media, query ... Simple and powerful tool for creating media queries with.
Read more >How to use media queries with styled components
Media queries with styled components work the same as in CSS! const CardWrapper = styled.div` display: flex; flex-direction: row; ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@filipnathanel In the near future I will investigate this issue and try to solve your problem.
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
css
blocks