I have a node.js VS 2015 project.
Now I downloaded the 'p2' physics engine via the integrated npm:
Now I want to use the module in my project. But I don't know how to import it, so it is recognized by the ts compiler.
I've downloaded an additional p2.d.ts file for typesafety it and put it into the project directory. Even if I reference the file it tells me 'p2' is not found:
if I use 'import p2 = require('./p2.d.ts');' instead. The compiler tells me './p2.d.ts' is not a module.
How do I call node.js modules from TypeScript and how do I add additional *.d.ts files which are not shipped with the node module?
I may help with the second part of your question .. in your $root/users/[you]
directory run this node command npm install tsd -g
Then use tsd (type script definition) to query tsd query [something]
or to install tsd install lodash
from the cmd line to find the *.d.ts files. Note in visual studio you might have to reorganize the installed files as VS expects a different directory. https://www.npmjs.com/package/tsd
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.