Gulp - typescript emits errors when saving, but fine with subsequent saves

I'm not sure if this is a gulp problem, typescript problem or Angular 2 problem.

I am currently using Angular 2 beta 6.

This is my typescript gulp task.

var tsProject = p.typescript.createProject("tsconfig.json");

gulp.task("client-scripts", function () {
    return gulp.src(paths.client.root + "**/*.ts")
        .pipe(p.cached("client-scripts"))
        .pipe(p.typescript(tsProject))
        .pipe(gulp.dest(paths.webroot.root));
});

And this is my tsconfig file.

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

My Angular 2 is a bootstrap file that includes some of the typifications that are required for beta 6 of angular. I think this is one area where the problem may arise.

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

import { bootstrap } from "angular2/platform/browser";
import { ROUTER_PROVIDERS } from "angular2/router";
import { HTTP_PROVIDERS } from "angular2/http";
import { DataPlatformComponent } from "./dataPlatform.component";
import "rxjs/add/operator/map";

bootstrap(DataPlatformComponent, [ROUTER_PROVIDERS, HTTP_PROVIDERS]);

This pad file contains only the declaration of the module variable, as a workaround to the problem in Angular 6 with the module property in the decorator @component. I don’t know if this could be the reason, but those links at the top are only in the boot.ts file, and not in any other subsequent ts file that I save.

gulp ...

[08:41:28] Starting 'entry'...
[08:41:28] Starting 'cleanup'...
[08:41:28] Finished 'entry' after 2.82 ms
[08:41:28] Finished 'cleanup' after 74 ms
[08:41:28] Starting 'initialize'...
[08:41:28] Starting 'vendor-scripts'...
[08:41:28] Starting 'vendor-content'...
[08:41:28] Starting 'client-scripts'...
[08:41:28] Starting 'client-nonscripts'...
[08:41:28] Starting 'client-sass'...
[08:41:28] Finished 'initialize' after 21 ms
[08:41:28] Finished 'vendor-scripts' after 176 ms
[08:41:28] Finished 'vendor-content' after 185 ms
[08:41:28] Finished 'client-sass' after 235 ms
[08:41:30] Finished 'client-scripts' after 2.31 s
[08:41:30] Finished 'client-nonscripts' after 2.3 s

typescript , ...

export class DataPlatformComponent {
}

export class DataPlatformComponent {

}

gulp. - .

[08:59:08] Starting 'client-scripts'...
C:/Github/Data-Platform/src/DataPlatform/client/platform/dashboard/dashboard.component.ts(4,15): error TS2304: Cannot find name 'module'.
client\platform\dataplatform.component.ts(8,15): error TS2304: Cannot find name 'module'.
[08:59:10] TypeScript: 62 semantic errors
C:/Github/Data-Platform/src/DataPlatform/client/platform/report catalog/details/chip.component.ts(6,15): error TS2304: Cannot find name 'module'.
C:/Github/Data-Platform/src/DataPlatform/client/platform/report catalog/details/reportDetails.component.ts(7,15): error TS2304: Cannot find name 'module'.
[08:59:10] TypeScript: emit failed
C:/Github/Data-Platform/src/DataPlatform/client/platform/report catalog/main/navigation.component.ts(8,15): error TS2304: Cannot find name 'module'.

rxjs.

[08:59:10] Finished 'client-scripts' after 2.08 s
C:/Github/Data-Platform/src/DataPlatform/client/platform/shell/navigation.component.ts(7,15): error TS2304: Cannot find name 'module'.
C:/Github/Data-Platform/src/DataPlatform/node_modules/angular2/src/core/change_detection/parser/locals.d.ts(3,14): error TS2304: Cannot find name 'Map'.
C:/Github/Data-Platform/src/DataPlatform/node_modules/angular2/src/core/change_detection/parser/locals.d.ts(4,42): error TS2304: Cannot find name 'Map'.
C:/Github/Data-Platform/src/DataPlatform/node_modules/angular2/src/core/debug/debug_node.d.ts(14,13): error TS2304: Cannot find name 'Map'.
C:/Github/Data-Platform/src/DataPlatform/node_modules/angular2/src/core/debug/debug_node.d.ts(24,17): error TS2304: Cannot find name 'Map'.

, ... , , , .

[09:02:50] Starting 'client-scripts'...
[09:02:51] Finished 'client-scripts' after 1.28 s

, ... , , , .

|-DataPlatform
    |-wwwroot
    |-client
        |-platform
            |-content
            |-dashboard
            |-report catalog
            |-shared
            |-shell
            boot.ts
            dataPlatform.component.ts
            dataPlatform.template.html
        index.html
    |-node_modules
    |-typings
        shim.d.ts
    gulpfile.js
    package.json
    project.json
    tsconfig.json
    Startup.cs
+4
1

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

TS.

. https://github.com/angular/angular/issues/7280#issuecomment-188777966

+6

Source: https://habr.com/ru/post/1630083/


All Articles