teambit / envs

Component development environments for the Bit community
https://bit.dev/bit/envs
Other
63 stars 9 forks source link

Cannot find name 'expect' error when building react-typescript #67

Closed Tallyb closed 4 years ago

Tallyb commented 4 years ago

Recieving these errors when using React-typescript compiler:

error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try npm i @types/jest or npm i @types/mocha. error TS2304: Cannot find name 'expect'.

Description

Adding the bit react-typescript compiler and running bit build throw the errors above.

Specifications

Tallyb commented 4 years ago

This is caused by the React compiler not finding the type definitions for Jest. Need to add the following in the package.json / bit.json:

"overrides": {
      "*": {
        "devDependencies": {
          "@types/jest": "^24.0.0"
        }
      }