Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude @types typings in installed dependencies

Is it possible to exclude global typings in installed dependencies?

I installed a local dependency. This also copied the node_modules folder of that dependency. This node_modules folder holds installed @types typings. These conflict with the @types typings installed for the main project.

Eg. project-path/node_modules/local-dependency/node_modules/@types/react conflicts with project-path/node_modules/@types/react.

Is it possible to make the typescript compiler ignore the typings in that local dependency?

like image 800
Pelle Jacobs Avatar asked Feb 09 '18 10:02

Pelle Jacobs


2 Answers

Did you try to use an empty array for types option?

{
  "compilerOptions": {
    ...,
    "types": []
  }
}

This disables automatic inclusion of types.

See the TypeScript documentation for more details.

like image 164
Conaclos Avatar answered Nov 20 '22 08:11

Conaclos


Alternatively, use "skipLibCheck": true in the compiler options.

like image 37
Erik Vullings Avatar answered Nov 20 '22 08:11

Erik Vullings