Skip to content

Automatic Typings Acquisition

Paul van Brenk edited this page Dec 12, 2017 · 21 revisions

🎵Note: This documentation is outdated at this point, especially when using the Node tools in Visual Studio 2017. We're working on update docs, and will redirect you to those when they're ready.

Starting with NTVS 1.2 for Visual Studio 2015, NTVS will automatically attempt to download typings for common Node packages in order to improve Javascript IntelliSense. These typings show up as the typings directory in your project and they will also be included in your Visual Studio projects.

Automatic Typings Acquisition status bar

Downloading typings automatically enables a much better Intellisense experience for Javascript projects.

When Are Typings Automatically Acquired?

Types are automatically downloaded if all of the following are true:

  • You are using the NTVS 1.2 Alpha+.
  • You are on VS 2015 (not VS "15").
  • You have a JavaScript project (not Typescript).
  • Intellisense mode is "ECMAScript 6".

Typings are automatically downloaded for all existing Node.js packages, as well as any new packages that are installed.

For instance, if you npm install the express module, the express.d.ts will be automatically downloaded from DefinitelyTyped and included in your project, and you'll be able to see the relevant completions next time you 'require' the module. image

How are Typings Acquired?

Typings are automatically acquired by NTVS whenever a new Node package is installed. The typings are downloaded using Typings and placed into a typings folder in each project, similar to the node_modules folder. Optionally a typings file can also be created to track which typings that are currently installed.

Additionally, in VS 2015, the typings files must be included the Visual Studio project in order for them to actually be picked up by our new Typescript based language service. In Visual Studio "15" Preview, the files are cached in a global location.

🎵Note: You can add the typings directory to your .gitignore to exclude it from source control, but this folder must remain referenced in the Visual Studio project.

Configuring Automatic Typings Acquisition

You can configure or disable automatic typings acquisition by going to Tools -> Options and then Text Editor -> Node.js -> IntelliSense. Make sure you are in ECMAScript 6 IntelliSense mode.

Automatic Typings Acquisition options pane

Automatically add IntelliSense typings folder to Node.js projects

Should typings be downloaded automatically and included in your project?

Show status bar after adding new typings folder to project

Should NTVS show the yellow info bar in the solution explorer when typings are first added to a project?

Save changes to typings.json config file

Should automatic typings acquisition create or update a typings.json with information about which typings are installed?