Friday, July 19, 2019

Installing Create React App with Typescript

I have found the following very interesting tutorial:

https://medium.com/@rossbulat/how-to-use-typescript-with-react-and-redux-a118b1e02b76

Here are some things that did not work at first.

1. Installing Create React App with Typescript
I had an older version of create-react-app, so it did not install typescript.
So i had to uninstall the global version and reinstall so that npx always takes the latest version:
npm uninstall -g create-react-app
npx create-react-app app_name --typescript

As described: https://facebook.github.io/create-react-app/docs/getting-started

2. Installing TSLint-React
I am using VSCode and when i run tslint --init i got this error:
tslint : The term 'tslint' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 
if a path was included, verify that the path is correct and try again.
I had to install like this:
npm install -g tslint typescript tslint-react
tslint --init


No comments:

Post a Comment