Installing a private package in @types - TypeScript and NPM

I have a repo that only the file index.d.ts(TypeScript definition file) was compromised , which I want to share with several repositories that I have. The only declaration in the type definition file is this interface:

interface MyInterface {
    thisSuperCoolFunction(): void;
}

Unfortunately, the definition of repo and all other repos that I use are private. Is it possible to send a private npm model project to @typesso that its installation just works, but also doesn't open it to anyone else?

Note: not typings repo, only @typeson npm.

+4
source share
1 answer

. git url


, @types/secret-library. index.d.ts.

package.json @types/secret-library

// package.json
{
  "name": "@types/secret-library",
  "private": true,
  "types:" "index.d.ts"
}

git url

index.d.ts package.json , . git.acme.com/secret-project.git.

// package.json
{
  "name": "doom-machine",
  "private": true,
  "dependencies":{
      "@types/secret-library": "git://git.acme.com/secret-project.git"
  }
}

index.d.ts package.json /home/evil-genius/doom-saucer

// package.json
{
  "name": "doom-machine",
  "private": true,
  "dependencies":{
      "@types/secret-library": "file:/home/evil-genius/doom-saucer"
  }
}
+2

Source: https://habr.com/ru/post/1664475/


All Articles