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.

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

  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

Angular HttpClient request fails to initiate

Overview: A button click on a form triggers the methodForm within the component. methodForm then calls methodService in the service layer. methodService is supposed to make an HTTP POST request. Problem: The HTTP POST request is not being made. However, me ...

What is the best way to implement a <Toast> using blueprintjs?

Struggling without typescript, I find it quite challenging to utilize the Toast feature. This component appears to have a unique appearance compared to the others. Shown below is an example code. How would you convert this to ES6 equivalent? import { But ...

The function does not yield any result

import { Injectable } from '@angular/core'; export class Test { public id: number; public name: string; public fid: number }; export const TESTS2: Test[] = [ {id: 1, name: 'Lion', fid: 1}, {id: 2, name: 'Tiger', fid: 1 ...

Unable to link to 'amount' because it is not a recognized attribute of 'ng-wrapper'

I recently made some changes to my code and now I'm encountering the error message "Can't bind to 'count' since it isn't a known property of 'ng-container'" Instead of having both the notification component and notificat ...

User interface designed for objects containing multiple keys of the same data type along with a distinct key

I have a question that relates to this topic: TypeScript: How to create an interface for an object with many keys of the same type and values of the same type?. My goal is to define an interface for an object that can have multiple optional keys, all of t ...

Subclass method overloading in Typescript

Take a look at this example: class A { method(): void {} } class B extends A { method(a: number, b: string): void {} } An error occurs when trying to implement method() in class B. My goal is to achieve the following functionality: var b: B; b.met ...

Is there a way to verify if the database has been successfully saved and the API call has been

I am currently in the process of developing a function that calls two other functions. Function 1 is responsible for saving an object to a database, while function 2 performs an API call. async createMSCalendarEntry(start: Date, end: Date, name: string ...

invoking a method within an express route to retrieve and utilize middleware functions

For my project, I am working on a custom function to handle API request validation. Here is how it looks: export function validateBody(schema: string): (req: ExpressRequest, res: ExpressResponse, next: ExpressNextFunction) => void { return function ...

The Gulp task is stuck in an endless cycle

I've set up a gulp task to copy all HTML files from a source folder to a destination folder. HTML Gulp Task var gulp = require('gulp'); module.exports = function() { return gulp.src('./client2/angularts/**/*.html') .pipe( ...

An HTML table featuring rows of input boxes that collapse when the default value is not filled in

My table is populated with dynamic rows of input boxes, some of which may have a default value while others return an empty string ''. This causes the table to collapse on those inputs. <tr *ngFor="let d of displayData"> < ...

To collapse a div in an HTML Angular environment, the button must be clicked twice

A series of divs in my code are currently grouped together with expand and collapse functionality. It works well, except for the fact that I have to click a button twice in order to open another div. Initially, the first click only collapses the first div. ...

The attribute 'map' is not found in the object 'MapPage'

I'm currently facing a challenge with integrating Google Maps into my Ionic 2 application that is based on the Tabs template. Everything was functioning properly until I attempted to initialize the this.map method within the constructor function. im ...

Getting the user's name and country using `auth().createUserWithEmailAndPassword` is a simple process

Hey there fellow developers. I'm fairly new to react native and I'm trying to implement firebase authentication for a project. However, I'm stuck on how to include user name and country when using the standard auth().createUserWithEmailAndPa ...

I encountered a TS error warning about a possible null value, despite already confirming that the value

In line 5 of the script, TypeScript raises an issue regarding the possibility of gameInstanceContext.gameInstance being null. Interestingly, this concern is not present in line 3. Given that I have verified its existence on line 1, it is perplexing as to w ...

Could one retrieve the value of a type and save it as a constant?

Can I achieve something similar to this: type YesType = true; const myVar = GetTypeValue<YesType>(); // In this instance, the value true is assigned Is it feasible to assign other fixed values to constant variables like in C++? ...

Changing the generic type's constraint type in TypeScript to have more flexibility

I have developed a utility type named DataType that takes in a parameter T restricted to the type keyof MyObject. When the key exists in MyObject, DataType will return the property type from MyObject; otherwise, it will simply return T. interface MyObject ...

Unlocking the secrets: Monitoring hardware keys in a react-native app

Currently, I am exploring a project that requires taking photos with a selfie stick. However, during my testing with the selfie stick, it only seems to trigger the volume up button. Now, I am looking for a way to detect the volume up button press or any ...

Bug found in React Native when navigating between screens causing the screen size to shrink

Check out the image below. https://i.stack.imgur.com/t04Vv.png Issue: Whenever I switch to a new scene, the previous screen appears to shrink or move upwards. This behavior is not consistent with the usual user experience seen on Apple apps - any thought ...

Storing information from JSON into an object

I am encountering an issue regarding transferring data from JSON to an object. Although this solution is functional, it is not entirely satisfactory. Take a look at the service. Is there an improved method for handling data conversion from this JSON to an ...

Conflicting events arising between the onMouseUp and onClick functions

I have a scrollbar on my page that I want to scroll by 40px when a button is clicked. Additionally, I want the scrolling to be continuous while holding down the same button. To achieve this functionality, I implemented an onClick event for a single 40px s ...