![](/img/trans.png)
[英]React: Using ES6 component in TS component: TS2605: JSX element type 'xxx' is not a constructor function for JSX elements
[英]<React.Fragment> with ts(2605) in VScode with checkJs enabled
我想在VScode中使用JS類型檢查功能。 一切都像魅力一樣工作,但是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)
這還不是全部,甚至從material-ui導入的組件都顯示simillar ts(2605)錯誤。
我的jsconfig.json是:
{
"compilerOptions": {
"module": "commonjs",
"checkJs": true,
"target": "esnext",
"jsx": "react",
"allowSyntheticDefaultImports": true
},
"include": [
"./**/*"
]
}
有人可以幫我找出我做錯了什么嗎?
謝謝。
這是有關@ types / react的問題,降級為“ @ types / react”:“ 16.7.13”。
yarn add @types/react@16.7.13
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.