Search code examples
javascriptreactjsreact-nativeantd

The following error occurred during the Herokuro react project build


antd input bar code It occurred while using input bar in antd. What's the reason?

TypeScript error in /tmp/build_1442ffe6/node_modules/antd/lib/input/Input.d.ts(16,11): Type expected. TS1110

       14 |     status?: InputStatus;
       15 |     bordered?: boolean;
     > 16 |     [key: `data-${string}`]: string;
          |           ^
       17 | }
       18 | declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
       19 | export default Input;

Solution

  • I had this problem exactly yesterday, it was solved only by upgrading the typescript version to upper than 4.4, in my use case I used:

    yarn add typescript@latest
    

    P.S: I encountered a lot of typing issues while type compiling(build time), I solved them and after that, I could build successfully.