For a project based on https://cli.angular.io, I needed to do the following:
1) Import libraries
npm install underscore --save
npm install @types/underscore --save
2) in tsconfig.app.json, add underscore to array ‘types’:
"types": [
"underscore"
]
3) In any component file I need to use underscore, I add this
import * as _ from 'underscore';
4) then I can use:
console.log('now: ', _.now());
and all functions of http://underscorejs.org