0
使用Javascript練習,如果我想測試的代碼塊現在停止程序的執行打字稿
function logic(a, b){
x= a+b;
y = x-5;
console.log(y);
return; // This is my break statement to make sure the function runs until y.
z = y*10; //This line is not executed.
}
而與angular2打字稿練習,如果我用回
logic(a, b) => {
x= a+b;
y = x-5;
console.log(y);
return; // Throws error
z = y*10; //I need to comment out this line to avoid error
}
它說檢測不到的代碼。有什麼辦法可以阻止執行嗎?
答案是在根文件夾
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowUnreachableCode": true, //add this line
"lib": [
"es2016"
]
}
}
'break;'? – mickdev