yarn pnp tsconfig include separate file from "node_modules"

55 views Asked by At

Due to our internal structure we had to create custom type definitions for third party JS libraries. However I am not allowed to publish them on NPM so they exist only in our private git (not github).

Before I updated to yarn with pnp I was able to include those type definitions as a dependency via

composer.json

"devDependencies": {
  "@types/my-custom-package": "git+https://<key>:<secret>@our.git.url.git"
}

Afterwards we included those in

tsconfig.json

"include": [
  "node_modules/@types/my-custom-package/index.d.ts"
]

However since yarn with pnp does not create a node_modules folder and all definitions only exists as zip files in cache directories I am not sure how to properly include my type definitions now. How can I add my custom types in tsconfig that are inside node_modules?

I tried several approaches found in the internet like like adding things into typeRoots

"typeRoots": [
  "types",
  "node_modules/@types",
  ".yarn/@types"
]

without any success.

0

There are 0 answers