This is how I go about it:
create-react-app your-app
cd your-app
tsc --init (initialize your Typescript config file)
mkdir ts (create a ts folder to store your Typescript source code)
- Delete existing files in your
src folder.
Edit your tsconfig.json file and set the following options:
"target": "es2017",
"module": "es2015",
"jsx": "react-native",
"outDir": "./src",
"rootDir": "./ts",
"moduleResolution": "node"
tsc -w -p . (start Typescript compiler in watch mode)
npm start (start React development script)
Now, create index.tsx in your ts folder and start building up your app. As you add and save files, they'll get compiled by Typescript compiler and copied into the src folder, where Babel/CRA will pick it up and transpile it to whatever CRA typically does. This method preserves the CRA (create-react-app) project structure, doesn't require substituting the react-scripts, etc. You just code in Typescript, the Typescript compiler will compile it to modern Javascript and CRA does the rest.
Caveat: While tsc will create the Javascript files in its output folder (src), you'll have to manually copy your css, images, and other static resources.