TypeScript module install

To install a module for use in TypeScript ('lodash' here as an example):

  1. 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
  2. Install types:
    npm i -D @types/lodash
Then you can use the module:
import * as _ from 'lodash';

Note, that it is best to set the TypeScript settings first (tsconfig.json).

A great guide here.

Comments

Popular posts from this blog

Write Unicode text using VBA

Calling Fortran intrinsic functions from Visual Basic

Dictionary class extensions (CopyTo, Sort) (C#)