Reactjs react应用程序中的antd,但未能编译

Reactjs react应用程序中的antd,但未能编译,reactjs,typescript,antd,Reactjs,Typescript,Antd,antd教程在typescript中的使用 创建反应应用程序…好的 纱线添加antd…好的 在App.css中导入antd.css…确定 但是我遇到了这个错误消息 D:/8VSCode/vcjoo-ant/src/App.tsx (16,10): Type '{ shape: "circle"; icon: string; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<Bu

antd教程在typescript中的使用

  • 创建反应应用程序…好的
  • 纱线添加antd…好的
  • 在App.css中导入antd.css…确定
  • 但是我遇到了这个错误消息

    D:/8VSCode/vcjoo-ant/src/App.tsx
    (16,10): Type '{ shape: "circle"; icon: string; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<Button> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<AnchorButtonProps> & Pick<InferProps<{ type: any; shape: any; size: any; htmlType: any; ... 4 more ...; block: any; }>, "htmlType">, "color" | ... 258 more ... | "htmlType"> & Partial<...> & Partial<...>) | ...'.
      Type '{ shape: "circle"; icon: string; }' is not assignable to type 'Pick<Readonly<{ children?: ReactNode; }> & Readonly<NativeButtonProps> & Pick<InferProps<{ type: any; shape: any; size: any; htmlType: any; onClick: any; loading: any; className: any; icon: any; block: any; }>, "htmlType">, "color" | ... 262 more ... | "value">'.
        Property 'htmlType' is missing in type '{ shape: "circle"; icon: string; }'.
    
    App.css

     @import '~antd/dist/antd.css';
    
        .App {
          text-align: center;
        }
    ...
    
    好了,我解决了

    首先,您将
    添加到[*.d.ts]文件中的“declare module'antd'”
    (例如:./images.d.ts)

    并添加到“htmlType”元素中 例如<代码>主代码

    Typescript是强大的代码! 因此,您可以使用[*.d.ts]中必须添加到模块的新模块

    我需要你对这个错误的建议 那是Thank's

    Thank@Chun Joo Park

    添加到[*.d.ts]文件中的“声明模块'antd'”(例如:./images.d.ts)

    为我工作,并重新启动我的应用程序

    yarn start
    

    使用命令
    npm install@types/module\u name

    或者在[*.d.ts]文件中声明模块,如下所述

    我添加到组件中的参数中,例如“因此,我可以使用组件!!但是..我遇到了另一个错误[ts]类型。。。
    yarn start