Nestjs getting @types/react errors in monorepo

Viewed 486

I am working with a monorepo using Yarn workpaces work my backend (using Nestjs) and my current frontend (CRA using Tailwind, I will also add a React Native app in the future), I managed to fix some problems with my React app, and it now starts normally, but now my Nestjs app is throwing errors regarding @types/react.

Here's a small part of the error when I try to start my backend app.

../node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3244:13 - error TS2717: Subsequent property declarati
ons must have the same type.  Property 'view' must be of type 'SVGProps<SVGViewElement>', but here has type 'SVGProps<SVGVi
ewElement>'.

3244             view: React.SVGProps<SVGViewElement>;
                 ~~~~

  ../node_modules/@types/react/index.d.ts:3245:13
    3245             view: React.SVGProps<SVGViewElement>;
                     ~~~~
    'view' was also declared here.
../node_modules/@types/react/index.d.ts:3057:14 - error TS2300: Duplicate identifier 'LibraryManagedAttributes'.

3057         type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent
<infer T>
                  ~~~~~~~~~~~~~~~~~~~~~~~~

  ../node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3054:14
    3054         type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticCompo
nent<infer T>
                      ~~~~~~~~~~~~~~~~~~~~~~~~
    'LibraryManagedAttributes' was also declared here.

Found 177 error(s).

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Here's the config and structure for my monorepo.

.
├── assets
├── mobile-app
├── mobile-pwa <-- Not yet included in the packages.
├── nest-backend
├── node_modules
├── package.json
├── readme.md
└── yarn.lock

5 directories, 3 files

The root's package.json

{
  "name": "foo",
  "private": true,
  "workspaces": {
    "packages": ["nest-backend", "mobile-pwa"]
  },
  "nohoist": ["**/**"]
}

The React app's package.json (will omit some stuff since it's pretty large)

{
  "name": "@foo/mobile-pwa",
  "version": "0.0.1",
  "private": true,
  "license": "UNLICENSED",
}

And the Nest.js backend's package.json

{
  "name": "@beextravel/nest-backend",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",

}

1 Answers
Related