-
Notifications
You must be signed in to change notification settings - Fork 27k
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
TypeScript error on <style> with attributes global
and jsx
#38333
Comments
Please verify your issue reproduces with |
Hi bot! Can't you read the |
Insight: it is working correctly on |
It also doesn't work with next canary @Jule- Have you been able to suppress the error until it gets fixed? It's quite annoying. The docs mention that
might help, but for me it did not: Source https://github.com/vercel/styled-jsx#typescript |
@wiesson ho nice catch, this seems to work in the CodeSandbox! I need more time to check that in my project. Did you have restarted your TS server after adding the type file? But even if it is working like that, this needs more documentation and it doesn't explain why this was working out of the box before. |
@wiesson I can confirm it works in my project. I put it in a project root folder named |
I was able to reproduce the issue in one of my projects: https://github.com/sukkaw/vercel-dns-console I have fixed the issue by copy-pasting |
@balazsorban44 Can you confirm that change spot by @tangye1234 is a wanted change? Or does it should be reverted (or fixed, I didn't check the history)? Thanks a lot! |
I think this commit should fix this issue 62f3f87 in the way @tangye1234 exposed. At least I don't have the issue on CodeSandbox with |
Closing per above, please update to the latest version of Next.js |
This still exists in v12.2.4 |
@anasik could you open a fresh issue with a reproduction? Would be good to verify this is the case with |
This issue still exists with |
me too |
I also encountered same error in my project with v12.2.5. |
I reproduced the problem.
https://github.com/seiyab/repro/tree/main/next-styled-jsx I'll open a fresh issue 💡 |
I found that a discussion for v12.2.5 has already opened. |
~(PR jsx-eslint/eslint-plugin-react#3377) introduced a change in `[email protected]` that will now show an error when unknown properties appear on elements. We can opt out of this by overriding the default.~ As discussed internally, we are turning `react/no-unknown-property` off, as it might be confusing even if different props are being used, (eg.: `css` for `emotion`). It's easy to fix https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md#rule-options, but it might not be clear at first glance that Next.js is using `eslint-plugin-react` internally. If the user wants to enforce this rule, they can still add it to their own `rules` config. Fixes #40321, ref: #40269, #38333
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
In my project when I try to create a component with global style I get a TypeScript error:
And what seems strange is that
[email protected]
seems to correctly define extension ofreact
type with:But for some reason, this seems not to be used by TypeScript.
Expected Behavior
No TS error.
Link to reproduction
https://codesandbox.io/s/musing-mcnulty-i2crqc?file=/components/Test.tsx
To Reproduce
Just hover the
global
attribute in order to see the TypeScript error.The text was updated successfully, but these errors were encountered: