How to migrate a whole React.js web-app to Typescript [closed]

37
November 26, 2020, at 05:20 AM
Closed. This question needs debugging details. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 22 hours ago.

Improve this question

I created a wen-app in React.js and Node.js. Unfortunately I discovered that some APIs and SDKs that I will have to use are coded in Typescript.

I just started programming so I'm probably going to ask a stupid question: in order to use this SDK and API do I have to convert all the code to typescript?

Basically I downloaded these modules and through npm I installed them in node_modules. I try to import them like I did with: Sequlize, React, Auth0... but I always get error for every module that i use:

src/index.js
Module not found: Can't resolve "...."

for everything I've imported into my files

I deleted jsconfing.json and add tsconfing.json:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": [
    "src"
  ]
}

Index.js:

import React from "react";
import ReactDOM from "react-dom";
import "assets/plugins/nucleo/css/nucleo.css";
import "@fortawesome/fontawesome-free/css/all.min.css";
import "assets/scss/argon-dashboard-react.scss";
import App from "./App.js"
import * as serviceWorker from './serviceWorker';
import { BrowserRouter as Router } from "react-router-dom";
import { Auth0Provider } from "@auth0/auth0-react";
ReactDOM.render(
  
  
  <Router>
   <Auth0Provider
      domain="mydomain.com"
      clientId="mycliednid"
      redirectUri="http://localhost:3000/admin/dashboard"
      audience="https://audience.sample"
     >
      <App />
    </Auth0Provider>
  </Router>,

document.getElementById('root'));
serviceWorker.unregister();
READ ALSO
How to handle errors in async Express?

How to handle errors in async Express?

Context: I have a rather large project which is a social media back endWe use MondoDB (w/ mongoose) and Express in JS

30
How can i redirect user to registration page when he failed to enter correct email (ID) in AMP form?

How can i redirect user to registration page when he failed to enter correct email (ID) in AMP form?

Please kindly advise if there is walk-around to redirect to new page when amp-form validation returns error? ie

43
NodeJS : The media could not be loaded, either because the server or network failed or because the format is not supported

NodeJS : The media could not be loaded, either because the server or network failed or because the format is not supported

I have a NodeJS server and I'd like to serve a local video, but I get an error when getting the link to the html page that says: The media could not be loaded, either because the server or network failed or because the format is not supported

54