<React.Fragment> with ts(2605) in VScode with checkJs enabled

688 Views Asked by At

I wanted to use JS type checking capability inside VScode. Everything works like charm but React.Fragment is linted with error:

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.

My jsconfig.json is:

{
    "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.

1

There are 1 best solutions below

0
Scc On

this is a problem about @types/react, Downgraded to "@types/react": "16.7.13".

yarn add @types/[email protected]