fastapi-react icon indicating copy to clipboard operation
fastapi-react copied to clipboard

Typescript errors on default install/up

Open mkbt opened this issue 3 years ago • 3 comments

Hi there,

I'm getting a bunch of Typescript errors in the browser console when bringing the docker-compose file up from defaults.

VM111:2 Uncaught ReferenceError: process is not defined
    at Object.4043 (<anonymous>:2:13168)
    at r (<anonymous>:2:306599)
    at Object.8048 (<anonymous>:2:9496)
    at r (<anonymous>:2:306599)
    at Object.8641 (<anonymous>:2:1379)
    at r (<anonymous>:2:306599)
    at <anonymous>:2:315627
    at <anonymous>:2:324225
    at <anonymous>:2:324229
    at HTMLIFrameElement.e.onload (index.js:1:1)
TypeScript error in /app/src/index.tsx(8,4):
'Router' cannot be used as a JSX component.
  Its instance type 'BrowserRouter' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'React.ReactNode' is not assignable to type 'import("/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'.  TS2786

     6 | 
     7 | ReactDOM.render(
  >  8 |   <Router>
       |    ^
     9 |     <App />
    10 |   </Router>,
    11 |   document.getElementById('root')

Is there a dependancy I'm missing?

I tried building from the latest commits via a fork mentioned at https://github.com/Buuntu/fastapi-react/issues/177 but still ran into further issues.

mkbt avatar Apr 16 '22 04:04 mkbt

Any update on this? Also curious

gegnew avatar Jun 24 '22 13:06 gegnew

i same you :(

hung96ad avatar Jul 07 '22 17:07 hung96ad

Update typescript to 4.1.0, then add this to your package.json at the root level:

 "resolutions": {
    "@types/react": "^17.0.38"
  },

You're still going to run into a ton of other issues though, from dependency mismatches to missing libraries. Fixing the MUI issues will be a pain. I honestly think it's not worth using the frontend portion of this app at all.

aeciorc avatar Jul 22 '22 17:07 aeciorc