March 22, 2017 § Leave a comment
- error TS2688: Cannot find type definition file for ‘lodash’
- error TS7016: Could not find a declaration file for module ‘himalaya’
For some reason, the TypeScript documentation talks a lot about how to create typings files for modules that don’t have them, but not about how to add them to your project. And it is incredibly difficult to Google the correct answer.
The best answer I found is from: https://www.bennadel.com/blog/3169-adding-custom-typings-files-d-ts-in-an-angular-2-typescript-application.htm
The actual answer is quite simple: are only four steps:
$ npm install -g --save typings # if you haven't already $ cat > custom.d.ts # type definition file for that module declare module 'custom'; ^D $ typings install --global --save file:custom.d.ts