Meirion Hughes Meirion Hughes - 1 year ago 137
TypeScript Question

gulp-typescipt and typescript's new @types typings?

I have installed

as a devDependency.

My gulp task to compile my typescript is like so:

gulp.task('compile:tests', ['compile:typescript', 'clean:tests'], function () {
var project = ts.createProject('tsconfig.json', { typescript: typescript });

var tsResult = gulp.src(['spec/**/*spec.ts'])

return tsResult.js

and my tsconfig.json

"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node"
"exclude": [

but this results in the errors:

spec\linter.spec.ts(7,1): error TS2304: Cannot find name 'describe'.

spec\linter.spec.ts(8,3): error TS2304: Cannot find name 'it'.

spec\linter.spec.ts(17,5): error TS2304: Cannot find name 'expect'.

spec\linter.spec.ts(20,3): error TS2304: Cannot find name 'it'.

How can I get typescript (when used by gulp-typescript) to recognize the

Answer Source

Updated: latest version fixes the issue: install with

npm install gulp-typescript@3

pre gulp-typescript@3: So far my work around has been to manually include all @types typings, like so:

gulp.src(['spec/**/*spec.ts', "./node_modules/@types/**/*.d.ts"])

if you have conflicting versions of typings (here's looking at you @types/node@x) then you can skip over them to avoid the duplicates:

  paths.source + '**/*.ts', 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download