*** Latest Updates January 2024 ***
Option 1
- To kickstart your project, use the
npx create-expo-app
command.
- Establish a
tsconfig.json
file in your project's main directory by running touch tsconfig.json
.
- Change the file extension from
App.js
to App.tsx
with mv App.js App.tsx
.
- Initiate the development server using either
yarn start
or npm run start
. This will guide you through installing necessary dependencies (typescript, @types/react, @types/react-native) and configuring your tsconfig.json
automatically.
- Transition to the "bare" workflow by executing
npx expo eject
.
For more detailed instructions, refer to the Expo Typescript support documentation.
Option 2
To initialize your project with TypeScript, use the following command:
npx react-native init MyApp --template react-native-template-typescript
.
For further information, check out the React Native Typescript support documentation.
Option 3
Simplify the process with one command: npx create-expo-app -t expo-ts
.
For additional insights, read the Starting React Native Project in 2024 article.
*** Original Guidance February 2022 ***
Option 1
- Get started by using the
expo init
command and select minimal
as your template. Alternatively, use this command: expo init --template bare-minimum --name <your-app-name>
.
- Create a
tsconfig.json
in your project root: touch tsconfig.json
.
- Rename
App.js
to App.tsx
: mv App.js App.tsx
.
- Launch your project with
expo start
. This will lead you to install essential dependencies (typescript, @types/react, @types/react-native) and configure your tsconfig.json
automatically.
For more guidance, consult the Expo Typescript support documentation.
Option 2
To simplify the setup, utilize this single command:
expo init --template @vladimir-vovk/expo-bare-typescript
.
For detailed instructions, have a look at the Starting React Native Project in 2022 article.
!! Keep in mind that the expo-template-bare-typescript
package is outdated and installs Expo 41.