一直在使用@ types/jquery 2.0.47現在沒有任何問題。我試圖升級到3.2.11,現在當我構建我的visual studio解決方案時,沒有任何編譯。我收到了大量的錯誤,但並不完全相同,但絕對相關。我正在使用typescript 2.4。例如:問題與@ types/jquery從2.0.47升級到3.2.11
構建:屬性「長度」不存在於類型'string |數字|串[]'。
if ($("#txtSelPrj") && $("#txtSelPrj").val().length > 0) ...
編譯:房產 'startsWith' 不會對類型「字符串存在|數字| string []'
var cityVal = $("#City").val();
if (cityVal.startsWith('MyCity')) ...
等等。以下是我的tsconfig.json。有什麼我錯過了爲什麼發生這種情況?
{
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"noImplicitAny": false,
"allowUnusedLabels": true,
"target": "es5",
"sourceMap": true,
"strictNullChecks": false,
"removeComments": true,
"baseUrl": "./scripts",
"declaration": false,
"paths": {
},
"lib": [
"dom",
"es6",
"scripthost",
"es5",
"es2015",
"es2015.promise",
"es2015.iterable"
],
"types": [
"angular-ui-bootstrap",
"angular",
"autolinker",
"bootbox",
"bootstrap-notify",
"bootstrap",
"bootstrap-switch",
"cldrjs",
"globalize",
"googlemaps",
"google.analytics",
"imagesloaded",
"jquery.blockui",
"jquery.bootstrap.wizard",
"jquery",
"jqueryui",
"jquery.validation",
"jsts",
"kendo-ui",
"masonry-layout",
"qtip2",
"signalr",
"urijs",
"moment"
]
},
"exclude": [
"node_modules",
"bower_components",
"build"
],
"typeRoots": [
"node_modules/@types",
"node_modules/moment"
],
"awesomeTypescriptLoaderOptions": {
"useBabel": true,
"useCache": true
},
"compileOnSave": true,
"buildOnSave": true
}
我想這是它然後。我真的沒有想到像這樣的升級會破壞我的整個應用程序,但我想我必須慢慢地進入這一個。謝謝。 – Phil