by onion2k · 7y ago · 0 comments
TypeScript support has been included with create-react-app since v2.1.0, with all the features enabled. VS Code ships with syntax highlighting and command completion for TS.
If you want to try it use;
npx create-react-app tsx-test
yarn add typescript @types/react
mv ./src/App.js ./src/App.tsx
yarn start
(WARNING: npx runs stuff from the internet on your machine)That will make a 'typescript' React app run on your machine. Obviously App.tsx isn't actually doing any TypeScript stuff, but if you add some it will work.
npx create-react-app my-app --typescriptI used this lib to get it to work: https://www.npmjs.com/package/typesafe-actions I wouldn't even know how to get it to work with just the regular react & redux types.