しばらくの間、@ types/jquery 2.0.47を使用していました。私は3.2.11にアップグレードしようとしましたが、ビジュアルスタジオソリューションを構築するときには何もコンパイルされません。何度もエラーが発生していますが、すべて同じではありませんが、間違いなく関連しています。私はtypescript 2.4を使用しています。例:@ type/jquery 2.0.47から3.2.11へのアップグレード
ビルド:プロパティ 'length'はタイプ 'string'に存在しません。番号| string [] '
if ($("#txtSelPrj") && $("#txtSelPrj").val().length > 0) ...
ビルド:プロパティ 'のstartsWithは、' タイプ「列に存在しません|番号|文字列[] '
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