When a developer is working on a project and wants to maintain the project for a long period of time then the user should need TypeScript. In order to use the TypeScript user should need to configure the TypeScript because it gives an option to configure the compiler. Moreover, users can configure the TypeScript as per their requirements and can effectively prioritize the type of errors. Given below are the steps that will enable the developer to use TypeScript in react native-

  • Creating a project in react native using-
    react-native init myapp --template typescript && node myapp/setup.js && cd myapp
  • Set up and configure TSlint
    npm install --save-dev tslint tslint-eslint-rules tslint-react tslint-config-prettier
  • Setting up Jest
    npm install --save-dev ts-jest
  • Setting up an enzyme
    npm install --save-dev enzyme enzyme-adapter-react-16 react-dom @types/enzyme @types/enzyme-adapter-react-16
  • Setting up a test library of react-native
    npm install --save-dev react-native-testing-library
BY Best Interview Question ON 12 Nov 2019