Unable to start an expo project in bare workflow using TypeScript

Can someone help me with setting up an expo bare workflow using TypeScript?

I ran the command "expo init [project name]" in my terminal, but I can't seem to find the minimal (TypeScript) option.

? Choose a template: » - Use arrow-keys. Return to submit.
    ----- Managed workflow -----
    blank               a minimal app as clean as an empty canvas
    blank (TypeScript)  same as blank but with TypeScript configuration
    tabs (TypeScript)   several example screens and tabs using react-navigation and TypeScript
    ----- Bare workflow -----
>   minimal             bare and minimal, just the essentials to get you started

Any suggestions on how to proceed?

Answer №1

*** Latest Updates January 2024 ***

Option 1

  1. To kickstart your project, use the npx create-expo-app command.
  2. Establish a tsconfig.json file in your project's main directory by running touch tsconfig.json.
  3. Change the file extension from App.js to App.tsx with mv App.js App.tsx.
  4. 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.
  5. 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

  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>
    .
  2. Create a tsconfig.json in your project root: touch tsconfig.json.
  3. Rename App.js to App.tsx: mv App.js App.tsx.
  4. 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.

Answer №2

+ 4.62.0: the latest update no longer allows for the creation of a Bare Workflow project with pre-configured Typescript support.

Here's what to do:

  1. Initialise your app by running: expo init your-app-name
  2. Choose: Bare Workflow -> Minimal
  3. Create a tsconfig.json file in the root directory of your project
  4. Start the project by running expo start. This will guide you through installing necessary dependencies (typescript, @types/react, @types/react-native) and configure your tsconfig.json automatically.

https://i.sstatic.net/R5fB1.png

  1. Edit tsconfig.json and add "strict": true

https://i.sstatic.net/PRgmi.png

  1. Rename App.js to App.tsx: use the command mv App.js App.tsx.

And that's it! 🥳

Your Bare Workflow project is now configured with Typescript!

Answer №3

I am also experiencing the same problem, but starting your project can be done by executing

 expo init --template expo-template-bare-typescript --name appname

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Organize items within an array based on dual properties rather than a single one

Here is an array of objects that I would like to group based on certain keys (JSON format): [ { "name": "john", "lastName": "doe", "gender": "male" }, { "name": &qu ...

React: Issue with input values not correctly updating across multiple fields when changing state toggles

I am working on a React component that needs to update input values for multiple players independently. However, I am facing an issue where toggling a state causes the first input's value to incorrectly propagate to all other inputs. Additionally, cle ...

What is the best way to set up environments for Google App Engine (GAE

After developing a web app with server and client components, I decided to deploy it to Google Cloud using App Engine. Although the deployment process was successful, the main issue lies in the non-functioning env_variables that are crucial for the applic ...

Implementing pagination within an Angular 11 Mat-table with grouping feature

Encountering an interesting issue with MatTable pagination and grouping simultaneously. I have two components each with a Mat-table featuring Pagination+Grouping. ComponentOne functions smoothly without any issues. When choosing to display 5 elements pe ...

Tips for refreshing the service page in Ionic 2

One of my services is called "user-data", and its main function is to fetch "user data" when a request is received. I have a specific page that is responsible for displaying this "user data". Upon loading the page, it retrieves the data and displays it. ...

Utilizing SCSS variables

Currently, I am in the process of developing an Angular 4 application using angular-cli and have encountered a minor issue. I am attempting to create a component that has the ability to dynamically load styling. The ComponentX component needs to utilize a ...

Utilizing regular expressions to search through a .md file in JavaScript/TS and returning null

I am currently using fs in JavaScript to read through a changelog.MD file. Here is the code snippet: const readFile = async (fileName: string) => { return promisify(fs.readFile)(filePath, 'utf8'); } Now I am reading my .md file with this fu ...

Make the if statement easier - Angular

Would you like to know a more efficient way to streamline this If statement? The variables are all strings and are reused in both conditions, but the outcome varies depending on whether it returns true or false. if(params.province && !params.str ...

Derivation of the general function parameter

To provide a solution to this problem, let's consider the example below where a function is used. The function returns the same type that it accepts as the first argument: function sample<U>(argument: (details: U) => U) { return null; } ...

What is the best way to retrieve the value of this object?

In my project, I am utilizing Angular 8 to extract data from a radio input. However, when I transmit this data to Node.js and then to a MongoDB database, it is not being properly registered. The entry in the database collection appears as follows: "__v" : ...

Exploring React Native Networking using react-native-router-flux

Hello everyone, I have a quick query. I am looking to assign each Button to a different page. import React, { Component } from 'react'; import { ActivityIndicator, FlatList, Text, View, TouchableOpacity } from 'react-native'; export ...

Disabling ESLint errors is not possible within a React environment

I encountered an eslint error while attempting to commit the branch 147:14 error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions I'm struggling to identify the issue in the code, even ...

The process of invoking the AsyncThunk method within the Reducer method within the same Slice

Within my slice using reduxjs/toolkit, the state contains a ServiceRequest object as well as a ServiceRequest array. My objective is to dispatch a call to a reducer upon loading a component. This reducer will check if the ServiceRequest already exists in ...

What is the proper way to specifically define a new property on the `global` object in TypeScript?

I want to define a type signature for the variable below: (global as any).State = { variables: {}, }; How can I declare the type of State? If I try (global as any).State: Something = ..., the compiler displays an error message saying ; expected. It se ...

Exploring the parent-child relationship of three components within Angular 2

Currently, I am developing a shopping cart using Angular 2. The application consists of two components - one for categories and another for product listings, both included in the main app component as children. However, I'm facing an issue where these ...

Angular findIndex troubleshooting: solutions and tips

INFORMATION = { code: 'no1', name: 'Room 1', room: { id: 'num1', class: 'school 1' } }; DATABASE = [{ code: 'no1', name: 'Room 1', room: { id: 'num1', ...

Global Enum in Typescript that is Optimized for Inlining during Compilation

I'm facing a challenge with an enum that is widely used in my project. Having to import it into every file is becoming cumbersome. Is there a way to define the enum in the .d.ts file so that it automatically gets included when compiled to Javascript? ...

In Javascript, check if an item exists by comparing it to null

I am working with a dropdown list that can be used for various types of data. Some of the data includes an isActive flag (a BOOLEAN) while others do not. When the flag is absent, I would like to display the dropdown item in black. However, if the flag exis ...

Ways to enhance focus on childNodes using Javascript

I am currently working on implementing a navigation system using a UL HTML Element. Here's the code I have so far: let htmlUL = <HTMLElement>document.getElementById('autocomplete_ul_' + this.name); if (arg.keyCode == 40) { // down a ...

Can you explain the distinction between needing ts-node and ts-node/register?

Currently, I am conducting end-to-end tests for an Angular application using Protractor and TypeScript. As I was setting up the environment, I came across the requirement to include: require("ts-node/register") Given my limited experience with Node.js, I ...