microsoft / TypeScript-React-Starter

A starter template for TypeScript and React with a detailed README describing how to use the two together.
MIT License
11.08k stars 1.21k forks source link

Error error TS6059: File '.../typescript-react-starter//src/App.test.tsx' is not under 'rootDir' '.../typescript-react-starter/src/src'. 'rootDir' is expected to contain all source files. #60

Open otmarjr opened 7 years ago

otmarjr commented 7 years ago

Hello,

I've tried to follow the steps in the readme, but I'm getting this strange error. I've followed the following steps:

1 - npm install -g create-react-app 2 - create-react-app typescript-react-starter --scripts-version=react-scripts-ts 3 - I have a structure similar to the one shown in the Readme, except for the yarn.lock and tsconfig.test.json files which I've got on my folder. 4 - After checking the folder structure, I've tried to fire up project by running npm start. However, the index page quickly flashes and then I got the following error, both in the browser and in vscode terminal:

error TS6059: File '/home/otmar/learning/typescript-react-starter/src/App.test.tsx' is not under 'rootDir' '/home/otmar/learning/typescript-react-starter/src/src'. 'rootDir' is expected to contain all source files.

Am I missing anything ? Strangely enough, App.test.tsx is indeed into the rootDir folder.

phdesign commented 7 years ago

Can confirm, getting the same issue following the same steps above.

$ npm --version
4.1.2
$ node --version
v7.7.1
$ create-react-app --version
1.4.0
zernie commented 6 years ago

Same for me

ls-jingbo-jin commented 6 years ago

Same, and I also get this error:

Failed to compile.

Error in /Users/xxx/Documents/TypeScript-React-Starter/node_modules/@types/jest/index.d.ts
(20,15): error TS2451: Cannot redeclare block-scoped variable 'expect'.