Petr Tomášek Petr Tomášek - 3 months ago 45
TypeScript Question

Gulp typescript tsconfig with Angular2

I have problem with excluding folders in my app. I'm using a gulp typescript for compilation and tsconfig file. Problem is with node_modules folder, which is still compiling.

Here is my gulpfile:

var tsProject = ts.createProject('tsconfig.json', { typescript: require('typescript') });

gulp.task('tscompile', function () {
var tsResult = tsProject.src("./angular/**/*.ts") // instead of gulp.src(...)
.pipe(ts(tsProject));

return tsResult.js.pipe(gulp.dest('./'));


});

tsconfig content:

{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"Scripts"
]
}


And my task runner console:


angular\chatApp.ts(5,21): error TS2305: Module '"C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/core"' has no exported member 'Scope'.
angular\nominationApp.ts(1,21): error TS2305: Module '"C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/core"' has no exported member 'Scope'.
angular\notificationApp.ts(1,33): error TS2305: Module '"C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/core"' has no exported member 'Scope'.
angular\searchApp.ts(4,21): error TS2305: Module '"C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/core"' has no exported member 'Scope'.
angular\teamRegisterApp.ts(1,21): error TS2305: Module '"C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/core"' has no exported member 'Scope'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/platform/browser.d.ts(77,90): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/common/pipes/async_pipe.d.ts(25,38): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/application_ref.d.ts(83,60): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/application_ref.d.ts(83,146): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/application_ref.d.ts(96,51): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/application_ref.d.ts(96,147): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/application_ref.d.ts(133,90): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/application_ref.d.ts(171,81): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/change_detection/parser/locals.d.ts(3,14): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/change_detection/parser/locals.d.ts(4,42): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/debug/debug_node.d.ts(14,13): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/debug/debug_node.d.ts(24,17): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/debug/debug_node.d.ts(25,17): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/di/provider.d.ts(436,103): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/di/provider.d.ts(436,135): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/linker/compiler.d.ts(12,50): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/linker/compiler.d.ts(16,41): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(108,136): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(156,150): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(197,128): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(203,127): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(204,141): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(205,119): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/render/api.d.ts(13,13): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/core/render/api.d.ts(14,84): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/async.d.ts(27,33): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/async.d.ts(28,45): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(1,25): error TS2304: Cannot find name 'MapConstructor'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(2,25): error TS2304: Cannot find name 'SetConstructor'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(4,27): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(4,39): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(7,9): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(8,30): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(11,43): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(12,27): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(14,23): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(15,25): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(95,41): error TS2304: Cannot find name 'Set'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(96,22): error TS2304: Cannot find name 'Set'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/collection.d.ts(97,25): error TS2304: Cannot find name 'Set'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/lang.d.ts(13,17): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/lang.d.ts(14,17): error TS2304: Cannot find name 'Set'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/lang.d.ts(78,59): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(2,14): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(7,32): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(8,38): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(9,35): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(9,93): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(10,34): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(11,32): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(11,149): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/facade/promise.d.ts(12,43): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/platform/browser/browser_adapter.d.ts(75,33): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/angular2/src/platform/dom/dom_adapter.d.ts(85,42): error TS2304: Cannot find name 'Map'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/CoreOperators.d.ts(35,67): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/CoreOperators.d.ts(50,66): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/CoreOperators.d.ts(89,67): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/CoreOperators.d.ts(94,38): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/CoreOperators.d.ts(94,50): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(46,62): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(47,42): error TS2304: Cannot find name 'Iterator'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(103,74): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(103,84): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(143,66): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(158,65): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(201,66): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(206,38): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/Observable.d.ts(206,50): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/observable/ForkJoinObservable.d.ts(6,50): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/observable/ForkJoinObservable.d.ts(7,58): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/observable/FromObservable.d.ts(7,38): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/observable/FromObservable.d.ts(7,51): error TS2304: Cannot find name 'Iterator'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/observable/PromiseObservable.d.ts(9,31): error TS2304: Cannot find name 'Promise'.
C:/Projects/hrajemevolejbal/HrajemeVolejbal/node_modules/rxjs/observable/PromiseObservable.d.ts(10,26): error TS2304: Cannot find name 'Promise'.


Every gulps are currently in latest version. Angular 2 is beta 7. Can You help me, where is problem? Very thanks.

Answer

Many of your errors can be fixed by referencing the browser.d.ts declaration file in the TypeScript file that calls bootstrap:

///<reference path="../node_modules/angular2/typings/browser.d.ts"/>

For the Scope errors, it's harder to say. What Scope class/interface are you trying to use?