2017-09-10 2 views
0

エラーを投げずにコンパイラを壊すように見えるMeteor/Angularコードで書くことができるいくつかのタイプのエラーが出てきました。いくつかの例:オブジェクトの途中で誤ってセミコロンがひどく物事を壊しMeteor/Typescript/Angularコンパイラのエラーの克服

export const foo = { 
    propA: 'abc', 
    propB: 123; 
    propc: 'value' 
} 

。 別:セミコロンが誤って配置され、再び

private _functionName(param1: string, param2: boolean; param3: string): void { // do stuff here } 

。第3:

ここで、コールバック関数は中括弧で囲む必要があります(セミコロンでも役立つかもしれません)。第四:指定.scssファイルが存在しない

import style from './this.component.scss'; 

(それが存在するが、通過します0バイトである場合 - それは、それはそれが失敗存在しないことのみの場合です)。

これらの間違いのそれぞれは、サーバー側ではクリーンコンパイル、読み込み画面ではアプリケーションが停止したエラーフリーのクライアントコンソールになります。

再現するかどうかの問題があります。以下はAmazon Linuxで私が取り組んでいる特定の環境パラメータです。

"devDependencies": { 
    "@types/chai": "3.4.34", 
    "@types/meteor": "^1.3.31", 
    "@types/mocha": "2.2.34", 
    "chai": "3.5.0", 
    "chai-spies": "0.7.1" 
    }, 
    "dependencies": { 
    "@angular/animations": "^4.1.3", 
    "@angular/common": "^4.1.3", 
    "@angular/compiler": "^4.1.3", 
    "@angular/core": "^4.1.3", 
    "@angular/forms": "^4.1.3", 
    "@angular/http": "^4.1.3", 
    "@angular/material": "^2.0.0-beta.5", 
    "@angular/platform-browser": "^4.1.3", 
    "@angular/platform-browser-dynamic": "^4.1.3", 
    "@angular/router": "^4.1.3", 
    "@mahpah/angular-cropper": "0.0.1", 
    "@ngx-translate/core": "^6.0.1", 
    "@types/htmlparser2": "^3.7.29", 
    "angular-draggable-droppable": "^1.0.1", 
    "angular2-meteor": "^0.7.1", 
    "angular2-meteor-accounts-ui": "^1.0.0", 
    "angular2-meteor-polyfills": "^0.1.1", 
    "angular2-meteor-tests-polyfills": "0.0.2", 
    "babel-runtime": "^6.23.0", 
    "hammerjs": "^2.0.8", 
    "htmlparser2": "^3.9.2", 
    "meteor-node-stubs": "^0.2.11", 
    "meteor-rxjs": "^0.4.7", 
    "ng-gallery": "^0.7.1", 
    "ngx-pagination": "^3.0.0", 
    "reflect-metadata": "^0.1.10", 
    "rxjs": "^5.2.0", 
    "simpl-schema": "^0.2.3", 
    "zone.js": "^0.8.11" 
    } 

    [email protected]    # Packages every Meteor app needs to have 
    [email protected]  # Packages for a great mobile UX 
    [email protected]     # The database Meteor supports right now 
    [email protected]   # Reactive variable for tracker 
    [email protected]     # Meteor's client-side reactive programming library 

    [email protected] # CSS minifier run for production mode 
    [email protected] # JS minifier run for production mode 
    [email protected]    # ECMAScript 5 compatibility for older browsers. 

    angular2-compilers 
    practicalmeteor:mocha 
    xolvio:cleaner 
    hwillson:stub-collections 
    dispatch:mocha-phantomjs 
    [email protected] 
    aldeed:collection2-core 
    aldeed:schema-deny 
    aldeed:schema-index 
    mdg:validated-method 
    mdg:validation-error 
    [email protected] 
    alanning:roles 
    tmeasday:publish-counts 
    dburles:collection-helpers 
    matb33:collection-hooks 
    [email protected] 
    edgee:slingshot 
    [email protected] 
    [email protected] 

{ 
    "compilerOptions": { 
    "target": "es5", 
    "lib": [ 
     "es6", 
     "dom" 
    ], 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "experimentalDecorators": true, 
    "emitDecoratorMetadata": true, 
    "sourceMap": true 
    }, 
    "exclude": [ 
    "node_modules" 
    ], 
    "compileOnSave": false, 
    "angularCompilerOptions": { 
    "genDir": "aot", 
    "skipMetadataEmit": true 
    } 
} 

私の質問は、それから、この次のとおりです。

はリンター、または私はそれがトラブルシューティングに役立つだろう見ていない午前、いくつかのデバッガログはありますか?私はいくつかのIDEがこれらのエラー(特にSCSSファイルがないこと)を強調していることを認識していますが、それは私の質問には答えません。

ありがとうございます!

答えて

1

あなたの問題はわかりませんが、すべてのケースでデフォルトのコンパイラ設定でエラーが表示されます。空のモジュールは、それがVSのコードでこのことについて警告を表示しないコンパイラエラーを生成しませんが

test.ts(5,13): error TS1005: ',' expected. 
test.ts(10,56): error TS1005: ',' expected. 

:次のコード:

import style from './bla'; // with bla.js being an empty file 

export const foo = { 
    propA: 'abc', 
    propB: 123; 
    propc: 'value' 
} 

function _functionName(param1: string, param2: boolean; param3: string): void {} 

は、次の出力を生成します。

Typescriptにリンターが必要な場合、tslintは素晴らしいツールです。しかし最初の2つは間違いなくコンパイルエラーです(少なくともTS 2.5の場合)

+0

これらは一度に集中して、環境にあるのか、それとも特定の場所にあるのかを見てみましょう。たとえば、最後の1つ:これが私の上で失敗する特定の場所は、Angularサービスにプライベートメソッドを割り当てています。私はこれを自由に再現することができます。私はバージョン情報を含むように自分のレスポンスを編集し、小さなプロジェクトをまとめて再現できるかどうか確認します。 –

関連する問題