English 中文(简体)
在反应堆开发方面,汇编和编码灯塔环境并不匹配
原标题:In React development, compile and vscode lint settings do not match

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

如果有人知道解决办法,请让我知道。

感谢阅读。

问题回答

By regenerating the nx workspace and porting the existing code, the error no longer occurs in vscode. It is possible that some part of the nx workspace was corrupted because it was created in a bad network environment. Thank you!





相关问题
How to use one react app into another react app?

I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...

how to get selected value in Ant Design

I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...

How to add a <br> tag in reactjs between two strings?

I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...

热门标签