ファイルをコンパイルして、コンパイルされたコードを動作させていますが、注釈は完全に無視されているようです。警告もエラーもありません。calcdeps.py を使用して、次のコマンドでコードをコンパイルします。
set calc="D:\software\closure compiler\library\closure\bin\calcdeps.py"
c:\Python27\python.exe %calc% ^
--path D:\flex_sdk_4.6\projects\EnglishConverter\bin\js\ ^
--input D:\flex_sdk_4.6\projects\EnglishConverter\bin\js\mmt\Mediator.js ^
--input D:\flex_sdk_4.6\projects\EnglishConverter\bin\js\mmt\DomDependent.js ^
--input D:\flex_sdk_4.6\projects\EnglishConverter\bin\js\mmt\WorkFlow.js ^
--input D:\flex_sdk_4.6\projects\EnglishConverter\bin\js\mmt\Messenger.js ^
--input D:\flex_sdk_4.6\projects\EnglishConverter\bin\js\mmt\data.js ^
--compiler_jar "D:\software\closure compiler\compiler.jar" ^
--output_mode compiled ^
--compiler_flags="--compilation_level=ADVANCED_OPTIMIZATIONS" ^
--compiler_flags="--formatting=PRETTY_PRINT" ^
--output_file D:\flex_sdk_4.6\projects\EnglishConverter\bin\js\main.js
pause
たとえば、Messenger.js には関数があります。
/**
* Replaces words in matches with a yes/no/all box
* @param {Array} matches contains the items of myApp.data that matched words in text
* @param {string} text contains the cleaned up user input (no html)
*/
myApp.Messenger.builtReplacewithOptions=function(matches,text){
一致する変数は配列である必要があり、この関数を呼び出すすべてのコードは配列で呼び出します。型チェックをテストするために、次のように配列を文字列に変更しました。
* @param {string} matches contains the items of myApp.data that matched words in text
再度コンパイルしましたが、警告やエラーは発生しません。バッチ ファイルでコンパイラにパラメータを追加しようとしました:
--compiler_flags="--jscomp_warning=checkTypes" ^
今、私は警告を受け取ります。私の質問は次のとおりです。すべての種類のチェックをオンにする必要がありますか? すべてのチェックをオンにして、一部のみを明示的にオフにする方法はありますか?