TypeScript module install
To install a module for use in TypeScript ('lodash' here as an example):
- Install 'lodash':
npm i lodash
If the node_modules folder is not created then you should create a packages.json file first:
npm init -y
- Install types:
npm i -D @types/lodash
import * as _ from 'lodash';
Note, that it is best to set the TypeScript settings first (tsconfig.json).
A great guide here.
Comments