create-react-app-typescript
create-react-app-typescript copied to clipboard
jest types conflict
See this SO issue, now that CRAT is using ts-jest, there seems to be a conflict with @types/jest which can result in a Duplicate identifier 'beforeEach' error in some dev environnement configurations. To remove the compilation error, I had to get rid of @types/jest in package.json
I spent a few hours trynig to figure out this issue, so if this is somehow related to this project, maybe mentionned in the docs (or corrected if possible) ?
CRA-TS is already using ts-jest for quite a while now, so an error of this kind would have raised earlier if it is a general one.
Duplicate identifier means that there is more than one type declaration for an identifer, in your case beforeEach. In most cases, this occurs if more than one version of a type definition is used in a project, e.g. because of transitive dependencies. If you hit an error like this, you should first check
yarn list <duplication-candidate>
resp.
npm ls <duplication-candidate>
to see if it yields more than one result (in most cases, it will).
Removing the lock file and let it be regenerated will likely help here.