Fred Yang
Fred Yang

Reputation: 2611

typings install module dependencies

I am trying to migrate tsd to typings, as typings seems to be replacement of tsd. So I run the following command for

typings install dt~express --global --save

and the output is like

typings INFO reference Stripped reference "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/serve-static/serve-static.d.ts" during installation from "express" (main) typings INFO reference Stripped reference "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/express-serve-static-core/express-serve-static-core.d.ts" during installation from "express" (main) express └── (No dependencies)

Then I run tsc to compile my express project, I got the error like

typings/globals/express/index.d.ts(4,34): error TS2307: Cannot find module 'serve-static'. typings/globals/express/index.d.ts(5,27): error TS2307: Cannot find module 'express-serve-static-core'.

Seems like typings did not install typings for express's dependencies. I don't have this problem with tsd. Because it support an option "--resolve", which install all typings for the dependencies as well.

Does typings has this "resolve" feature as well?

Thanks

Upvotes: 2

Views: 1732

Answers (2)

Ajay
Ajay

Reputation: 4971

To migrate from tsd to typings, follow these steps:-

1) npm uninstall tsd or npm uninstall tsd -g according to your usage.

2) Now install typings globally using npm install typings -g.

3) You can upgrade tsd.json to typings.json using typings init --upgrade. It will create a new typings.json file inside project root.

4) Remove tsd.json file from root.

5) Install typings.json using typings install.

6) Now all project related typings are installed inside typings folder.

7) For frontend application include browser.d.ts file for reference, for server side application use main.d.ts.

Reference: migrate tsd to typings

Regards

Ajay

Upvotes: -1

Paarth
Paarth

Reputation: 10397

Unfortunately there doesn't seem to be one. Take a look at the FAQ

References

During installation, all references (E.g. /// ) are stripped. They are stripped because of their ambiguous nature - it can not be determined if the reference should be included within the source or is a dependency. 90% of the time, it's better to strip. If the reference is something you require for the project to work, you can always install the references as dependencies manually.

You'll have to install any references you need yourself.

There is discussion in this issue about a proper --follow-references tag. The author has announced that he is accepting PRs for that change, but to my knowledge none have made it in just yet.

Upvotes: 2

Related Questions