Start a new typescript react project
create-react-app <app_name> --scripts-version=react-scripts-ts
Basic deps
# For building css and js in the same command
yarn add npm-run-all
# For using Sass
yarn add node-sass-chokidar
# React Deps
yarn add react react-redux redux react-redux-router history react-router-dom
# Useful utils
yarn add bootstrap jquery
Ensuring that you can use absolute paths when importing
# tsconfig.json
"compilerOptions": {
...
"baseUrl": "src/"
}
Package.json scripts for building sass and js
# package.json
{
...
"scripts": {
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
"start-js": "node scripts/start.js",
"start": "npm-run-all -p watch-css start-js",
"build-js": "node scripts/build.js",
"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
"build": "npm-run-all build-css build-js",
"test": "node scripts/test.js --env=jsdom"
}
}