[英]<React.Fragment> with ts(2605) in VScode with checkJs enabled
I wanted to use JS type checking capability inside VScode. 我想在VScode中使用JS类型检查功能。 Everything works like charm but React.Fragment is linted with error:
一切都像魅力一样工作,但是React.Fragment出错了:
JSX element type 'ReactElement<any>' is not a constructor function for JSX elements.
Type 'ReactElement<any>' is missing the following properties from type 'Element': nodeName, attributes, childrents(2605)
And this is not all, even imported components from material-ui show simillar ts(2605) error. 这还不是全部,甚至从material-ui导入的组件都显示simillar ts(2605)错误。
My jsconfig.json is: 我的jsconfig.json是:
{
"compilerOptions": {
"module": "commonjs",
"checkJs": true,
"target": "esnext",
"jsx": "react",
"allowSyntheticDefaultImports": true
},
"include": [
"./**/*"
]
}
Can someone help me please to find out what am I doing wrong? 有人可以帮我找出我做错了什么吗?
Thanks. 谢谢。
这是有关@ types / react的问题,降级为“ @ types / react”:“ 16.7.13”。
yarn add @types/react@16.7.13
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.