-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
TS2322: Property 'css' does not exist... #1249
Comments
I fixed this by changing my tsconfig.json to: {
"compilerOptions": {
"types": ["@emotion/core"]
}
} |
Ran into the same issue. If you have already tried @nhooyr 's solution and still get errors. The next step would be a fresh install of dependencies. (npm install or yarn install). If that doesn't work, try nuking (deleting) the node_modules folder and do a fresh reinstall then reload your IDE / text editor |
I'm still getting the same error, none of the above helped... I'm have a freshly created an app using |
If it helps somehow, you can create custom type declaration like next one
and specify in |
I keep getting the not found error even thought the definitions is in the same file. /Users/lrodr0923/repos/brackets/src/App.tsx
and this is what the interface definition looks like: interface IBrackets { Thanks for helping |
Are there any updates on this issue? I am still getting this problem. Is a special tsconfig required? Edit: |
Closing this as no runnable repro case has been provided on which I could take a look at. That being said: I believe that when using |
For Emotion 11 use the following configuration in your {
"compilerOptions": {
"types": ["@emotion/react/types/css-prop"]
}
} Documentation: https://emotion.sh/docs/emotion-11#css-prop-types |
thanks that worked for me! |
For me, it was adding |
React 17 with Typescript 4.2 and Emotion.js 11.1 setupJust add the following line to and import with
in tsconfig.json make shure to have |
TL;DR: for React 17, Typescript 4.2, Emotion 11.1
{
"compilerOptions": {
...
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
...
}
} This seems to be the cleanest solution that works for me that does NOT require:
See: Emotion TypeScript Additional Context: Prior comments and the Emotion 11 docs linked in prior comments seemed to suggest that upgrading to a version of TypeScript > 4.1 would somehow resolve this issue (and by "resolve" I presumed this would mean removing the need for either the suggested |
What do you do if you're already using |
With [email protected], [email protected], and all storybook imports at v6.5.9, the issue is resolved when referencing the emotion types in a global Filename:
I tried using the I also couldn't use the React 17 tsconfig options because we are still on React 16. Hope this helps someone else! |
Hi guys,
and then update my babel config so it transpiles the styles declared in the prop:
|
Add This fixed for me their full Documentations on CSS: https://emotion.sh/docs/@emotion/babel-preset-css-prop |
Or update this |
With [email protected], [email protected], @emotion/[email protected], TypeScript in strict mode: My use-case is slightly different as I'm building components whose types extend the HTMLAttributes of basic types. Before upgrading @emotion/react (from @emotion/[email protected]), the
to include the Regardless, this code fixed my issue:
|
@SRochas Please always try to share a repro case in a runnable form - either by providing a git repository to clone or a codesandbox. OSS maintainers usually can't afford the time to set up the repro, even if exact steps are given. |
This is work for me without error. |
good solutions by adding this config currently working fine. |
just add. /** @jsxImportSource @emotion/react */ to the component that's having this error. |
I know this is closed, but just leaving a helpful note for anyone that might come across this. If your linter is complaining about this error, but your site loads fine while running First, check if that's the case by opening
Open Then, just save and reload your IDE. The linter should stop complaining at that point. |
emotion
: version: 10.0.7emotion-theming
: 10.0.7@emotion/core
: version: 10.0.7@emotion/styled
: version: 10.0.7@emotion/cache
: version: 10.0.react
version: 16.7.0typescript
version: 3.2.4Relevant code:
tsconfig.json
:Example TS error:
pragma
Related Issues:
The text was updated successfully, but these errors were encountered: