我試圖用typescript 2.5.3將vue js升級到2.5.2。Vue js 2.5.2&typecript升級錯誤
這裏是我的index.ts文件:
import Vue from 'vue'
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
})
這裏是我的tsconfig.json
{
"compilerOptions": {
"outDir": "./wwwroot/build/",
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"lib": [
"dom",
"es5",
"es2015.promise"
],
"types": [
"vue-typescript-import-dts"
],
"experimentalDecorators": true
},
"include": [
"Features/**/*.ts"
],
"exclude": [
"node_modules",
"wwwroot"
]
}
,這裏是錯誤消息:
在 答案:C :\ dev \ proj \ src \ Proj.Web \ node_modules \ vue-typescript-import-dts \ index.d.ts (3,36):error TS2304:Can not fi nd名字'Vue'。
我的設置與vue js 2.4一起工作正常。
我刪除「allowSyntheticDefaultImports」:真實,as said here
此前,我們已經建議使用ES風格的進口(進口的Vue 從 'VUE')處處以「allowSyntheticDefaultImports」:在 真tsconfig.json。新類型將正式轉換爲ES風格 導入/導出語法,因此不再需要配置,並且在所有情況下都需要用戶 使用ES樣式導入。
任何人都看到我失蹤了嗎?
刪除類型部分並allowSyntheticDefaultImports做到了!謝謝 – Swell