Typescript error in antd pro project in Visual Studio Code

41 views Asked by At

My Antd Pro project shows typescript errors in Vscode.

'ProFormSelect' cannot be used as a JSX component.
  Its type '(<T = any>(props: ProFormSelectProps<T>) => ReactElement<any, string | JSXElementConstructor<any>>) & { SearchSelect: <T>(props: ProFormSelectProps<...>) => ReactElement<...>; }' is not a valid JSX element type.
    Type '(<T = any>(props: ProFormSelectProps<T>) => ReactElement<any, string | JSXElementConstructor<any>>) & { SearchSelect: <T>(props: ProFormSelectProps<...>) => ReactElement<...>; }' is not assignable to type '(props: any, deprecatedLegacyContext?: any) => ReactNode'.
      Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
        Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.

I use Antd Pro components.

After installing fresh windows 11 system, I've got this error in all Antd Pro Components.

I had no errors on old same operating system. So it's quite weird and don't know how to fix it.

Environment: Windows 11, Latest Visual Studio Code
Nodejs: v18.17.0

Main packages info: 

    "react": "^17.0.0",
    "react-dom": "^17.0.0",
    "typescript": "^4.5.0",

    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",

    "@umijs/fabric": "^2.8.0",

    "@ant-design/compatible": "^1.1.0",
    "@ant-design/icons": "^4.7.0",
    "@ant-design/pro-card": "^1.19.0",
    "@ant-design/pro-descriptions": "^1.10.0",
    "@ant-design/pro-form": "^1.64.0",
    "@ant-design/pro-layout": "^6.35.0",
    "@ant-design/pro-table": "^2.71.0",
    "@babel/runtime": "^7.20.6",
    "@lexical/react": "^0.3.6",
    "@tinymce/tinymce-react": "^4.1.0",
    "@umijs/route-utils": "^2.0.0",
    "antd": "^4.19.0",

0

There are 0 answers