I'm giving a shot at typescript. It works fine at the hello world stage. I'm now trying to use a npm module :
index.ts =
import _ = require('lodash')
console.log(_.toUpper('Hello, world !'))
This doesn't work :
- tsc index.ts->- Cannot find module 'lodash'. (2307)
- node-ts index.js->- Cannot find module 'lodash'. (2307)
Looking at typescript documentation and in google didn't help. Other S/O questions are either unanswered (here and here) or unrelated.
Elements :
- typescript 1.8 latest
- Yes, lodash is installed npm i --save lodashand exists in my filesystem (checked)
- I also did typings i --save lodash
- variants import * as _ from 'lodash'orconst _ = require('lodash')don't work either
- I tried tweaking tsconfig.json options as suggested in other answers  "moduleResolution": "node"and"module": "commonjs"as suggested in some answers, still doesn't work
How do we consume a npm package in typescript ??
 
     
     
     
     
     
    