0
我最近更新到VSCode 1.6.1,它從Typescript 1.8.10切換到2.0.3,這使我的項目停止工作。VisualStudio代碼運行時錯誤的手稿版本
的思考方法已經改變所以現在路由的控制器試圖獲得的方法時拋出以下錯誤屬性:
TypeError: Reflect.getMetadata is not a function
at exports.Body (C:\FN\FantasyNation\Stormbringer\node_modules\routing-contr
ollers\decorator\params.js:155:30)
at __param (C:\FN\FantasyNation\Stormbringer\Scripts\controllers\UserControl
ler.js:12:37)
at __decorate (C:\FN\FantasyNation\Stormbringer\Scripts\controllers\UserCont
roller.js:5:110)
at Object.<anonymous> (C:\FN\FantasyNation\Stormbringer\Scripts\controllers\
UserController.js:56:1)
繼發行說明中的指示切換到一個特定的版本在我工作空間我裝老打字稿工作區:
npm install [email protected]
當重新打開VSCode沒有問我關於TS版的使用,所以我手動更新我的工作區「settings.json」指定它:
{
"files.exclude": {
"**/*.js.map": true,
"**/*.js": {"when": "$(basename).ts"}
},
"editor.stablePeek": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
當我打開 「的.ts」 文件VSCode顯示正確的版本:
但經過重建(Ctrl + Shift + B),並再次運行(F5)我仍然得到完全相同的錯誤。
我tsconfig是:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"inlineSourceMap": true,
"watch": false
},
"exclude": [
"node_modules"
]
}
我的啓動設置爲:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app.js",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"externalConsole": true,
"sourceMaps": true,
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5959
}
]
}
我錯過了什麼?