Typescript-react-starter: Cannot make it work

Created on 30 Nov 2018  Â·  6Comments  Â·  Source: microsoft/TypeScript-React-Starter

I first clone master repository, then do:
npm install
npm run start

node version: 11.3.0

and then i get this output:
Failed to compile.

Error in /home/vitalik/projects/TypeScript-React-Starter/node_modules/@types/enzyme/index.d.ts
(368,15): error TS2304: Cannot find name 'Cheerio'.

Error in /home/vitalik/projects/TypeScript-React-Starter/node_modules/@types/enzyme/index.d.ts
(640,69): error TS2304: Cannot find name 'Cheerio'.

Error in /home/vitalik/projects/TypeScript-React-Starter/node_modules/@types/enzyme/index.d.ts
(13,23): error TS2688: Cannot find type definition file for 'cheerio'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(5,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(7,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(10,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(12,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(15,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(17,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(20,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(21,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(26,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/components/Hello.test.tsx
(27,3): error TS2304: Cannot find name 'expect'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/App.tsx
(5,14): error TS2304: Cannot find name 'require'.

Error in /home/vitalik/projects/TypeScript-React-Starter/src/App.test.tsx
(5,1): error TS2304: Cannot find name 'it'.

Error in /home/vitalik/projects/TypeScript-React-Starter/tsconfig.json
error TS2688: Cannot find type definition file for 'cheerio'.

Error in /home/vitalik/projects/TypeScript-React-Starter/tsconfig.json
error TS2688: Cannot find type definition file for 'jest'.

Error in /home/vitalik/projects/TypeScript-React-Starter/tsconfig.json
error TS2688: Cannot find type definition file for 'node'.

Most helpful comment

@painreign

I think you node version 11.3.0 is newly then the TypeScript-React-Starter create.

The two way to solve:

  • 1.You use old version node (but I don't know wath's the node version when the project create)
  • 2.You still use new version code, but you must Upgrades packages to their latest version

I use Upgrades packages to their latest version ,here is step:

Upgrades packages to their latest version

yarn upgrade --latest

and then fix source file index.tsx

+ import { EnthusiasmAction } from './actions/index';
-  const store = createStore<StoreState>(enthusiasm, {
+ const store = createStore<StoreState, EnthusiasmAction, any, any>(enthusiasm, {

and then fix source file Hello.tsx

-- import { connect, Dispatch } from 'react-redux';
++ import { connect } from 'react-redux';
++ import { Dispatch } from 'redux';

Why you must fix source file , some packages(like redux) not incompatible with new version.

My node version is v10.14.1

All 6 comments

Create our new project
We'll create a new project called my-app:

create-react-app my-app --scripts-version=react-scripts-ts

The readme.md clearly states that you use it this way. not the way you described

i see thank you, however this is not clear.

I don't see much value in repository if it doesn't work. Probably you should make repository working instead of telling how to fix it in README

I am sorry but I don't get this point. Could you explain the idea how broken repository should be used and why you are keeping it with kind of duplicating information in README?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript-React-Starter/issues/240#issuecomment-443385827,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA5XS5Y6h5QDHSAKAb2Di2Ig0DV4sNCzks5u0dfJgaJpZM4Y75Mq
.

@painreign

I think you node version 11.3.0 is newly then the TypeScript-React-Starter create.

The two way to solve:

  • 1.You use old version node (but I don't know wath's the node version when the project create)
  • 2.You still use new version code, but you must Upgrades packages to their latest version

I use Upgrades packages to their latest version ,here is step:

Upgrades packages to their latest version

yarn upgrade --latest

and then fix source file index.tsx

+ import { EnthusiasmAction } from './actions/index';
-  const store = createStore<StoreState>(enthusiasm, {
+ const store = createStore<StoreState, EnthusiasmAction, any, any>(enthusiasm, {

and then fix source file Hello.tsx

-- import { connect, Dispatch } from 'react-redux';
++ import { connect } from 'react-redux';
++ import { Dispatch } from 'redux';

Why you must fix source file , some packages(like redux) not incompatible with new version.

My node version is v10.14.1

I have created a pull-request #242 to make it work with NodeJS v10 and React v16. I hope it will be integrated soon.

issues still exist...

I got the exact same results of OP while strictly following the README. Didn't change anything, not even choosing a different name than my-app.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wuchaoya picture wuchaoya  Â·  9Comments

wilomgfx picture wilomgfx  Â·  6Comments

Arelav picture Arelav  Â·  4Comments

wongjiahau picture wongjiahau  Â·  9Comments

simonccarter picture simonccarter  Â·  3Comments