We are doing front-end development using TypeScript and React. We are implementing nx as project management and creating the above front part as one project. I have installed @emotion/react as styling, but I am getting an error regarding this.
Error Message
Type { children: Element; css: SerializedStyles; } cannot be assigned to type DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> .
Property css does not exist for type DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> . ts(2322)
The error is not displayed when compiling, but only in vscode s lint. The compilation passes by adding the following text to tsconfig.json as a solution to the error message, and since it continues to be displayed in vscode, we think there may be a difference in the tsconfig.json that is being read.
"types": ["@emotion/react/types/css-prop"]
这一发展不会因为汇编的通过而停止,但我希望加以改进,因为没有必要的电灯出现错误,发展效率也会降低。
Code
<div css={rootStyle}>{props.children}</div>
我尝试重新启用开发通道,重新启用密码,但没有改进。
Environments
- docker:4.21.1
- vscode:1.80.0
- Dev Container:0.299.0
- react:18.2.0
- @emotion/react:11.11.1
如果有人知道解决办法,请让我知道。
感谢阅读。