4

I can install @types/sanctuary with running yarn install @types/sanctuary.

But I want to install @types/sanctuary from this forked repo: https://github.com/vicrac/DefinitelyTyped/blob/master/types/sanctuary/index.d.ts

How can I do this with yarn or npm?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
mohsen saremi
  • 685
  • 8
  • 22

1 Answers1

3

Yarn and npm have their own registries so that when you tell them to install (e.g.) @types/express, they will look through their files and hand them to you. GitHub repos, and any other package that's not on their registries will not be available to install using the (yarn/npm) install @types/... command.

Definitely Typed is a collection of packages, to which people contribute and then (I think) get sent to npm and the like. If you want to install your version of sanctuary then you should change the structure of your fork (or make a new one) to make it look like a regular package.

I will be using this twitter.js repo as an example

From npm, you can install a TypeScript package from a git repo like this: npm install git+{url}.git (See this answer)

npm install --save git+https://github.com/twitterjs/twitter.js.git

and then import it in your typescript files like this

import twitter from "twitter.js"
ivanlewin
  • 54
  • 5