'React' was used before it was defined

前端 未结 14 2004
傲寒
傲寒 2020-12-29 19:28

I am working with create-react-app + typescript + eslint application and during build have such error:

Line 1:8:  \'React\' was used before it was defined  @t         


        
相关标签:
14条回答
  • 2020-12-29 20:08

    This has been resolved in 4.4.0. Upgrade these dependencies to version 4.4.0

    Update: This may work for some use cases. This resolved my issue.

    "@typescript-eslint/eslint-plugin": "^4.4.0",
    "@typescript-eslint/parser": "^4.4.0",
       
    
    0 讨论(0)
  • 2020-12-29 20:10

    I deleted packages @typescript-eslint/eslint-plugin and @typescript-eslint/parser from my package.json, deleted node_modules and package-lock.json, reinstalled packages: npm install The error disappeared.

    UPDATE

    After that create-react-app uses their own @typescript-eslint/eslint-plugin module which is deprecated.

    0 讨论(0)
提交回复
热议问题