Emotion: Use with Next.js and Typescript there is error:'Global' refers to a value, but is being used as a type here

Created on 13 Apr 2020  路  3Comments  路  Source: emotion-js/emotion

Current behavior:
Use with Next.js and Typescript there is error:'Global' refers to a value, but is being used as a type here

To reproduce:
Add global style in nextjs _app.js:
<Global styles={css
html,
body {
padding: 3rem 1rem;
margin: 0;
background: papayawhip;
min-height: 100%;
font-family: Helvetica, Arial, sans-serif;
font-size: 24px;
}
} />

Environment information:

invalid

Most helpful comment

Most likely you'd have to change the extension of the file in question to .tsx (or .jsx)

All 3 comments

Most likely you'd have to change the extension of the file in question to .tsx (or .jsx)

Closing as I've already pointed out the most probable cause in the past and haven't heard back from the OP since then.

Changing extension to .tsx worked.

Used this example as a guide to include emotion with NextJS, here using .js, instead of .jsx: https://github.com/vercel/next.js/blob/canary/examples/with-emotion/shared/styles.js

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnbrett picture johnbrett  路  3Comments

sami616 picture sami616  路  3Comments

smlmrkhlms picture smlmrkhlms  路  3Comments

AlexanderProd picture AlexanderProd  路  3Comments

meebix picture meebix  路  3Comments