Manaus Manaus - 3 months ago 17
TypeScript Question

Gulp interface not hinted in intellisense

I have installed the

gulp
definition from the DefinitelyTyped repository, along with node.d.ts, but in Code I see no intellisense.

// gulpfile.ts
/// <reference path="./typings/gulp/gulp.d.ts" />
let gulp: Gulp = require("gulp"); // Cannot find name Gulp


What am I doing wrong?

Thanks

Answer
  1. Remove /// <reference ...>
  2. Use import syntax: import * as gulp from 'gulp';

To be sure follow these steps:

  1. Install gulp via npm
  2. Install typings via npm
  3. Add in package.json in scripts section: "postinstall": "typings install --save"
  4. Add typings.json alongside package.json

    { "globalDependencies": { "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts", "gulp": "github:DefinitelyTyped/DefinitelyTyped/gulp/gulp.d.ts" } }

  5. run npm install

These steps should get you working gulp + typings for it.