กำลังเพิ่มคำตอบด้านบน ...
ตามเอกสาร VS Code ..
ตรวจสอบให้แน่ใจว่าคุณวางjsconfig.json ไว้ที่รูทของโปรเจ็กต์ JavaScript ของคุณไม่ใช่แค่ที่รูทของพื้นที่ทำงานของคุณ ด้านล่างนี้คือไฟล์ jsconfig.json ซึ่งกำหนดเป้าหมาย JavaScript เป็น ES6 และแอตทริบิวต์ exclude จะไม่รวมโฟลเดอร์ node_modules
{
"compilerOptions": {
"target": "ES6"
},
"exclude": [
"node_modules"
]
}
นี่คือตัวอย่างที่มีแอตทริบิวต์ Explicit files
{
"compilerOptions": {
"target": "ES6"
},
"files": [
"src/app.js"
]
}
ไม่สามารถใช้แอตทริบิวต์ files ร่วมกับแอตทริบิวต์ exclude หากระบุทั้งสองอย่างแอตทริบิวต์ files จะมีความสำคัญเหนือกว่า
ลองแก้ไขคุณสมบัติ "target" ใน tsconfig.json ด้วย
{
"compilerOptions": {
"target": "es5",//es6
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}