@typescript-deploys/pr-build 4.9.0-pr-50856-4 → 4.9.0-pr-50776-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/de/diagnosticMessages.generated.json +1 -2
- package/lib/es/diagnosticMessages.generated.json +1 -2
- package/lib/ja/diagnosticMessages.generated.json +1 -2
- package/lib/ko/diagnosticMessages.generated.json +1 -2
- package/lib/lib.dom.d.ts +199 -58
- package/lib/lib.webworker.d.ts +73 -24
- package/lib/pt-br/diagnosticMessages.generated.json +1 -2
- package/lib/ru/diagnosticMessages.generated.json +1 -2
- package/lib/tr/diagnosticMessages.generated.json +1 -2
- package/lib/tsc.js +150 -90
- package/lib/tsserver.js +324 -149
- package/lib/tsserverlibrary.d.ts +3 -0
- package/lib/tsserverlibrary.js +324 -149
- package/lib/typescript.d.ts +3 -0
- package/lib/typescript.js +324 -149
- package/lib/typescriptServices.d.ts +3 -0
- package/lib/typescriptServices.js +324 -149
- package/lib/typingsInstaller.js +154 -95
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -2
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -99,7 +99,7 @@ var ts;
|
|
|
99
99
|
// The following is baselined as a literal template type without intervention
|
|
100
100
|
/** The version of the TypeScript compiler release */
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
102
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.
|
|
102
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220922");
|
|
103
103
|
/* @internal */
|
|
104
104
|
var Comparison;
|
|
105
105
|
(function (Comparison) {
|
|
@@ -3008,7 +3008,7 @@ var ts;
|
|
|
3008
3008
|
];
|
|
3009
3009
|
for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
|
|
3010
3010
|
var ctor = nodeConstructors_1[_i];
|
|
3011
|
-
if (!ts.hasProperty(ctor, "__debugKind")) {
|
|
3011
|
+
if (!ts.hasProperty(ctor.prototype, "__debugKind")) {
|
|
3012
3012
|
Object.defineProperties(ctor.prototype, {
|
|
3013
3013
|
// for use with vscode-js-debug's new customDescriptionGenerator in launch.json
|
|
3014
3014
|
__tsDebuggerDisplay: {
|
|
@@ -9123,6 +9123,7 @@ var ts;
|
|
|
9123
9123
|
_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
|
|
9124
9124
|
We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
|
|
9125
9125
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
9126
|
+
This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
9126
9127
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
9127
9128
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
9128
9129
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -10065,6 +10066,8 @@ var ts;
|
|
|
10065
10066
|
Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
|
|
10066
10067
|
Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
|
|
10067
10068
|
Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
|
|
10069
|
+
Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."),
|
|
10070
|
+
Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
10068
10071
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
10069
10072
|
Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
10070
10073
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -45240,6 +45243,7 @@ var ts;
|
|
|
45240
45243
|
}
|
|
45241
45244
|
}
|
|
45242
45245
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
45246
|
+
var _a;
|
|
45243
45247
|
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
|
|
45244
45248
|
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
|
|
45245
45249
|
var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
@@ -45254,13 +45258,7 @@ var ts;
|
|
|
45254
45258
|
return withPackageId(packageInfo, fromDirectory);
|
|
45255
45259
|
}
|
|
45256
45260
|
}
|
|
45257
|
-
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
45258
45261
|
var loader = function (extensions, candidate, onlyRecordFailures, state) {
|
|
45259
|
-
var _a;
|
|
45260
|
-
// package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
|
|
45261
|
-
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
45262
|
-
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
45263
|
-
}
|
|
45264
45262
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
45265
45263
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths);
|
|
45266
45264
|
if (!pathAndExtension && packageInfo
|
|
@@ -45273,19 +45271,24 @@ var ts;
|
|
|
45273
45271
|
}
|
|
45274
45272
|
return withPackageId(packageInfo, pathAndExtension);
|
|
45275
45273
|
};
|
|
45276
|
-
|
|
45277
|
-
|
|
45278
|
-
|
|
45274
|
+
var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest;
|
|
45275
|
+
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
|
|
45276
|
+
if (rest !== "") {
|
|
45277
|
+
// Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now.
|
|
45279
45278
|
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
45280
|
-
|
|
45281
|
-
|
|
45282
|
-
|
|
45283
|
-
|
|
45284
|
-
|
|
45285
|
-
|
|
45286
|
-
|
|
45287
|
-
|
|
45288
|
-
|
|
45279
|
+
}
|
|
45280
|
+
// package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them)
|
|
45281
|
+
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
45282
|
+
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
45283
|
+
}
|
|
45284
|
+
if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
|
|
45285
|
+
if (state.traceEnabled) {
|
|
45286
|
+
trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest);
|
|
45287
|
+
}
|
|
45288
|
+
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
|
|
45289
|
+
var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
|
|
45290
|
+
if (fromPaths) {
|
|
45291
|
+
return fromPaths.value;
|
|
45289
45292
|
}
|
|
45290
45293
|
}
|
|
45291
45294
|
return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
@@ -49787,6 +49790,7 @@ var ts;
|
|
|
49787
49790
|
var deferredGlobalOmitSymbol;
|
|
49788
49791
|
var deferredGlobalAwaitedSymbol;
|
|
49789
49792
|
var deferredGlobalBigIntType;
|
|
49793
|
+
var deferredGlobalNaNSymbol;
|
|
49790
49794
|
var deferredGlobalRecordSymbol;
|
|
49791
49795
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49792
49796
|
var flowLoopStart = 0;
|
|
@@ -55465,6 +55469,7 @@ var ts;
|
|
|
55465
55469
|
&& symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */
|
|
55466
55470
|
&& !(symbol.flags & 4194304 /* SymbolFlags.Prototype */)
|
|
55467
55471
|
&& !(symbol.flags & 32 /* SymbolFlags.Class */)
|
|
55472
|
+
&& !(symbol.flags & 8192 /* SymbolFlags.Method */)
|
|
55468
55473
|
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
55469
55474
|
if (propertyAsAlias) {
|
|
55470
55475
|
var createdExport = serializeMaybeAliasAssignment(symbol);
|
|
@@ -60275,7 +60280,7 @@ var ts;
|
|
|
60275
60280
|
var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
|
|
60276
60281
|
// If the symbols are instances of one another with identical types - consider the symbols
|
|
60277
60282
|
// equivalent and just use the first one, which thus allows us to avoid eliding private
|
|
60278
|
-
// members when intersecting a (this-)instantiations of a class with
|
|
60283
|
+
// members when intersecting a (this-)instantiations of a class with its raw base or another instance
|
|
60279
60284
|
if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
|
|
60280
60285
|
// If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
|
|
60281
60286
|
// to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
|
|
@@ -60323,7 +60328,11 @@ var ts;
|
|
|
60323
60328
|
}
|
|
60324
60329
|
}
|
|
60325
60330
|
}
|
|
60326
|
-
if (!singleProp ||
|
|
60331
|
+
if (!singleProp ||
|
|
60332
|
+
isUnion &&
|
|
60333
|
+
(propSet || checkFlags & 48 /* CheckFlags.Partial */) &&
|
|
60334
|
+
checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) &&
|
|
60335
|
+
!(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) {
|
|
60327
60336
|
// No property was found, or, in a union, a property has a private or protected declaration in one
|
|
60328
60337
|
// constituent, but is missing or has a different declaration in another constituent.
|
|
60329
60338
|
return undefined;
|
|
@@ -60425,6 +60434,33 @@ var ts;
|
|
|
60425
60434
|
}
|
|
60426
60435
|
return property;
|
|
60427
60436
|
}
|
|
60437
|
+
function getCommonDeclarationsOfSymbols(symbols) {
|
|
60438
|
+
var commonDeclarations;
|
|
60439
|
+
var _loop_14 = function (symbol) {
|
|
60440
|
+
if (!symbol.declarations) {
|
|
60441
|
+
return { value: undefined };
|
|
60442
|
+
}
|
|
60443
|
+
if (!commonDeclarations) {
|
|
60444
|
+
commonDeclarations = new ts.Set(symbol.declarations);
|
|
60445
|
+
return "continue";
|
|
60446
|
+
}
|
|
60447
|
+
commonDeclarations.forEach(function (declaration) {
|
|
60448
|
+
if (!ts.contains(symbol.declarations, declaration)) {
|
|
60449
|
+
commonDeclarations.delete(declaration);
|
|
60450
|
+
}
|
|
60451
|
+
});
|
|
60452
|
+
if (commonDeclarations.size === 0) {
|
|
60453
|
+
return { value: undefined };
|
|
60454
|
+
}
|
|
60455
|
+
};
|
|
60456
|
+
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
|
|
60457
|
+
var symbol = symbols_3[_i];
|
|
60458
|
+
var state_4 = _loop_14(symbol);
|
|
60459
|
+
if (typeof state_4 === "object")
|
|
60460
|
+
return state_4.value;
|
|
60461
|
+
}
|
|
60462
|
+
return commonDeclarations;
|
|
60463
|
+
}
|
|
60428
60464
|
function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
|
|
60429
60465
|
var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
60430
60466
|
// We need to filter out partial properties in union types
|
|
@@ -61139,7 +61175,7 @@ var ts;
|
|
|
61139
61175
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
61140
61176
|
if (indexSymbol.declarations) {
|
|
61141
61177
|
var indexInfos_4 = [];
|
|
61142
|
-
var
|
|
61178
|
+
var _loop_15 = function (declaration) {
|
|
61143
61179
|
if (declaration.parameters.length === 1) {
|
|
61144
61180
|
var parameter = declaration.parameters[0];
|
|
61145
61181
|
if (parameter.type) {
|
|
@@ -61153,7 +61189,7 @@ var ts;
|
|
|
61153
61189
|
};
|
|
61154
61190
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
61155
61191
|
var declaration = _a[_i];
|
|
61156
|
-
|
|
61192
|
+
_loop_15(declaration);
|
|
61157
61193
|
}
|
|
61158
61194
|
return indexInfos_4;
|
|
61159
61195
|
}
|
|
@@ -61170,7 +61206,7 @@ var ts;
|
|
|
61170
61206
|
var _a;
|
|
61171
61207
|
var inferences;
|
|
61172
61208
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
61173
|
-
var
|
|
61209
|
+
var _loop_16 = function (declaration) {
|
|
61174
61210
|
if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
|
|
61175
61211
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
61176
61212
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -61234,7 +61270,7 @@ var ts;
|
|
|
61234
61270
|
};
|
|
61235
61271
|
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
61236
61272
|
var declaration = _b[_i];
|
|
61237
|
-
|
|
61273
|
+
_loop_16(declaration);
|
|
61238
61274
|
}
|
|
61239
61275
|
}
|
|
61240
61276
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61891,6 +61927,9 @@ var ts;
|
|
|
61891
61927
|
function getGlobalBigIntType() {
|
|
61892
61928
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61893
61929
|
}
|
|
61930
|
+
function getGlobalNaNSymbol() {
|
|
61931
|
+
return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
|
|
61932
|
+
}
|
|
61894
61933
|
function getGlobalRecordSymbol() {
|
|
61895
61934
|
deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61896
61935
|
return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
|
|
@@ -62131,7 +62170,7 @@ var ts;
|
|
|
62131
62170
|
var lastRequiredIndex = -1;
|
|
62132
62171
|
var firstRestIndex = -1;
|
|
62133
62172
|
var lastOptionalOrRestIndex = -1;
|
|
62134
|
-
var
|
|
62173
|
+
var _loop_17 = function (i) {
|
|
62135
62174
|
var type = elementTypes[i];
|
|
62136
62175
|
var flags = target.elementFlags[i];
|
|
62137
62176
|
if (flags & 8 /* ElementFlags.Variadic */) {
|
|
@@ -62161,9 +62200,9 @@ var ts;
|
|
|
62161
62200
|
}
|
|
62162
62201
|
};
|
|
62163
62202
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
62164
|
-
var
|
|
62165
|
-
if (typeof
|
|
62166
|
-
return
|
|
62203
|
+
var state_5 = _loop_17(i);
|
|
62204
|
+
if (typeof state_5 === "object")
|
|
62205
|
+
return state_5.value;
|
|
62167
62206
|
}
|
|
62168
62207
|
// Turn optional elements preceding the last required element into required elements
|
|
62169
62208
|
for (var i = 0; i < lastRequiredIndex; i++) {
|
|
@@ -62191,7 +62230,7 @@ var ts;
|
|
|
62191
62230
|
if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
|
|
62192
62231
|
lastOptionalOrRestIndex = expandedFlags.length;
|
|
62193
62232
|
}
|
|
62194
|
-
expandedTypes.push(type);
|
|
62233
|
+
expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
|
|
62195
62234
|
expandedFlags.push(flags);
|
|
62196
62235
|
if (expandedDeclarations && declaration) {
|
|
62197
62236
|
expandedDeclarations.push(declaration);
|
|
@@ -62357,7 +62396,7 @@ var ts;
|
|
|
62357
62396
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
62358
62397
|
if (templates.length) {
|
|
62359
62398
|
var i = types.length;
|
|
62360
|
-
var
|
|
62399
|
+
var _loop_18 = function () {
|
|
62361
62400
|
i--;
|
|
62362
62401
|
var t = types[i];
|
|
62363
62402
|
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -62365,7 +62404,7 @@ var ts;
|
|
|
62365
62404
|
}
|
|
62366
62405
|
};
|
|
62367
62406
|
while (i > 0) {
|
|
62368
|
-
|
|
62407
|
+
_loop_18();
|
|
62369
62408
|
}
|
|
62370
62409
|
}
|
|
62371
62410
|
}
|
|
@@ -62442,14 +62481,14 @@ var ts;
|
|
|
62442
62481
|
var namedUnions = [];
|
|
62443
62482
|
addNamedUnions(namedUnions, types);
|
|
62444
62483
|
var reducedTypes = [];
|
|
62445
|
-
var
|
|
62484
|
+
var _loop_19 = function (t) {
|
|
62446
62485
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
62447
62486
|
reducedTypes.push(t);
|
|
62448
62487
|
}
|
|
62449
62488
|
};
|
|
62450
62489
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
62451
62490
|
var t = typeSet_1[_i];
|
|
62452
|
-
|
|
62491
|
+
_loop_19(t);
|
|
62453
62492
|
}
|
|
62454
62493
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
62455
62494
|
return namedUnions[0];
|
|
@@ -63679,7 +63718,7 @@ var ts;
|
|
|
63679
63718
|
var result;
|
|
63680
63719
|
var extraTypes;
|
|
63681
63720
|
var tailCount = 0;
|
|
63682
|
-
var
|
|
63721
|
+
var _loop_20 = function () {
|
|
63683
63722
|
if (tailCount === 1000) {
|
|
63684
63723
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63685
63724
|
result = errorType;
|
|
@@ -63800,10 +63839,10 @@ var ts;
|
|
|
63800
63839
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63801
63840
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63802
63841
|
while (true) {
|
|
63803
|
-
var
|
|
63804
|
-
if (typeof
|
|
63805
|
-
return
|
|
63806
|
-
if (
|
|
63842
|
+
var state_6 = _loop_20();
|
|
63843
|
+
if (typeof state_6 === "object")
|
|
63844
|
+
return state_6.value;
|
|
63845
|
+
if (state_6 === "break")
|
|
63807
63846
|
break;
|
|
63808
63847
|
}
|
|
63809
63848
|
return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
|
|
@@ -66418,7 +66457,7 @@ var ts;
|
|
|
66418
66457
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
66419
66458
|
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
|
|
66420
66459
|
}
|
|
66421
|
-
var
|
|
66460
|
+
var _loop_21 = function (prop) {
|
|
66422
66461
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
66423
66462
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
66424
66463
|
if (reportErrors) {
|
|
@@ -66481,9 +66520,9 @@ var ts;
|
|
|
66481
66520
|
};
|
|
66482
66521
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
66483
66522
|
var prop = _b[_i];
|
|
66484
|
-
var
|
|
66485
|
-
if (typeof
|
|
66486
|
-
return
|
|
66523
|
+
var state_7 = _loop_21(prop);
|
|
66524
|
+
if (typeof state_7 === "object")
|
|
66525
|
+
return state_7.value;
|
|
66487
66526
|
}
|
|
66488
66527
|
return false;
|
|
66489
66528
|
}
|
|
@@ -67474,11 +67513,11 @@ var ts;
|
|
|
67474
67513
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
67475
67514
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
67476
67515
|
var matchingTypes = [];
|
|
67477
|
-
var
|
|
67516
|
+
var _loop_22 = function (combination) {
|
|
67478
67517
|
var hasMatch = false;
|
|
67479
67518
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
67480
67519
|
var type = _d[_c];
|
|
67481
|
-
var
|
|
67520
|
+
var _loop_23 = function (i) {
|
|
67482
67521
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
67483
67522
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
67484
67523
|
if (!targetProperty)
|
|
@@ -67494,8 +67533,8 @@ var ts;
|
|
|
67494
67533
|
}
|
|
67495
67534
|
};
|
|
67496
67535
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
67497
|
-
var
|
|
67498
|
-
switch (
|
|
67536
|
+
var state_9 = _loop_23(i);
|
|
67537
|
+
switch (state_9) {
|
|
67499
67538
|
case "continue-outer": continue outer;
|
|
67500
67539
|
}
|
|
67501
67540
|
}
|
|
@@ -67508,9 +67547,9 @@ var ts;
|
|
|
67508
67547
|
};
|
|
67509
67548
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
67510
67549
|
var combination = discriminantCombinations_1[_a];
|
|
67511
|
-
var
|
|
67512
|
-
if (typeof
|
|
67513
|
-
return
|
|
67550
|
+
var state_8 = _loop_22(combination);
|
|
67551
|
+
if (typeof state_8 === "object")
|
|
67552
|
+
return state_8.value;
|
|
67514
67553
|
}
|
|
67515
67554
|
// Compare the remaining non-discriminant properties of each match.
|
|
67516
67555
|
var result = -1 /* Ternary.True */;
|
|
@@ -68215,7 +68254,7 @@ var ts;
|
|
|
68215
68254
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
68216
68255
|
links.variances = ts.emptyArray;
|
|
68217
68256
|
var variances = [];
|
|
68218
|
-
var
|
|
68257
|
+
var _loop_24 = function (tp) {
|
|
68219
68258
|
var modifiers = getVarianceModifiers(tp);
|
|
68220
68259
|
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
|
|
68221
68260
|
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
|
|
@@ -68253,7 +68292,7 @@ var ts;
|
|
|
68253
68292
|
};
|
|
68254
68293
|
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
68255
68294
|
var tp = typeParameters_2[_i];
|
|
68256
|
-
|
|
68295
|
+
_loop_24(tp);
|
|
68257
68296
|
}
|
|
68258
68297
|
links.variances = variances;
|
|
68259
68298
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68845,7 +68884,8 @@ var ts;
|
|
|
68845
68884
|
function getOptionalType(type, isProperty) {
|
|
68846
68885
|
if (isProperty === void 0) { isProperty = false; }
|
|
68847
68886
|
ts.Debug.assert(strictNullChecks);
|
|
68848
|
-
|
|
68887
|
+
var missingOrUndefined = isProperty ? missingType : undefinedType;
|
|
68888
|
+
return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]);
|
|
68849
68889
|
}
|
|
68850
68890
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
68851
68891
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
@@ -70210,7 +70250,7 @@ var ts;
|
|
|
70210
70250
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
70211
70251
|
// succeed. That would be a pointless and confusing outcome.
|
|
70212
70252
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
70213
|
-
var
|
|
70253
|
+
var _loop_25 = function (i) {
|
|
70214
70254
|
var source_1 = matches ? matches[i] : neverType;
|
|
70215
70255
|
var target_3 = types[i];
|
|
70216
70256
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -70260,7 +70300,7 @@ var ts;
|
|
|
70260
70300
|
inferFromTypes(source_1, target_3);
|
|
70261
70301
|
};
|
|
70262
70302
|
for (var i = 0; i < types.length; i++) {
|
|
70263
|
-
|
|
70303
|
+
_loop_25(i);
|
|
70264
70304
|
}
|
|
70265
70305
|
}
|
|
70266
70306
|
}
|
|
@@ -70724,7 +70764,7 @@ var ts;
|
|
|
70724
70764
|
return name;
|
|
70725
70765
|
}
|
|
70726
70766
|
}
|
|
70727
|
-
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
70767
|
+
if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
|
|
70728
70768
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
70729
70769
|
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
70730
70770
|
}
|
|
@@ -70784,7 +70824,7 @@ var ts;
|
|
|
70784
70824
|
function mapTypesByKeyProperty(types, name) {
|
|
70785
70825
|
var map = new ts.Map();
|
|
70786
70826
|
var count = 0;
|
|
70787
|
-
var
|
|
70827
|
+
var _loop_26 = function (type) {
|
|
70788
70828
|
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
|
|
70789
70829
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70790
70830
|
if (discriminant) {
|
|
@@ -70810,9 +70850,9 @@ var ts;
|
|
|
70810
70850
|
};
|
|
70811
70851
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70812
70852
|
var type = types_15[_i];
|
|
70813
|
-
var
|
|
70814
|
-
if (typeof
|
|
70815
|
-
return
|
|
70853
|
+
var state_10 = _loop_26(type);
|
|
70854
|
+
if (typeof state_10 === "object")
|
|
70855
|
+
return state_10.value;
|
|
70816
70856
|
}
|
|
70817
70857
|
return count >= 10 && count * 2 >= types.length ? map : undefined;
|
|
70818
70858
|
}
|
|
@@ -77267,7 +77307,7 @@ var ts;
|
|
|
77267
77307
|
if (spreadIndex >= 0) {
|
|
77268
77308
|
// Create synthetic arguments from spreads of tuple types.
|
|
77269
77309
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
77270
|
-
var
|
|
77310
|
+
var _loop_27 = function (i) {
|
|
77271
77311
|
var arg = args[i];
|
|
77272
77312
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
77273
77313
|
var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -77284,7 +77324,7 @@ var ts;
|
|
|
77284
77324
|
}
|
|
77285
77325
|
};
|
|
77286
77326
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
77287
|
-
|
|
77327
|
+
_loop_27(i);
|
|
77288
77328
|
}
|
|
77289
77329
|
return effectiveArgs_1;
|
|
77290
77330
|
}
|
|
@@ -77613,7 +77653,7 @@ var ts;
|
|
|
77613
77653
|
var min_3 = Number.MAX_VALUE;
|
|
77614
77654
|
var minIndex = 0;
|
|
77615
77655
|
var i_1 = 0;
|
|
77616
|
-
var
|
|
77656
|
+
var _loop_28 = function (c) {
|
|
77617
77657
|
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
|
|
77618
77658
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
|
|
77619
77659
|
if (diags_2) {
|
|
@@ -77631,7 +77671,7 @@ var ts;
|
|
|
77631
77671
|
};
|
|
77632
77672
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
77633
77673
|
var c = candidatesForArgumentError_1[_a];
|
|
77634
|
-
|
|
77674
|
+
_loop_28(c);
|
|
77635
77675
|
}
|
|
77636
77676
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
77637
77677
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77789,7 +77829,7 @@ var ts;
|
|
|
77789
77829
|
}
|
|
77790
77830
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77791
77831
|
var parameters = [];
|
|
77792
|
-
var
|
|
77832
|
+
var _loop_29 = function (i) {
|
|
77793
77833
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77794
77834
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77795
77835
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77797,7 +77837,7 @@ var ts;
|
|
|
77797
77837
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77798
77838
|
};
|
|
77799
77839
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77800
|
-
|
|
77840
|
+
_loop_29(i);
|
|
77801
77841
|
}
|
|
77802
77842
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77803
77843
|
var flags = 0 /* SignatureFlags.None */;
|
|
@@ -80579,6 +80619,7 @@ var ts;
|
|
|
80579
80619
|
var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
|
|
80580
80620
|
error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
80581
80621
|
}
|
|
80622
|
+
checkNaNEquality(errorNode, operator, left, right);
|
|
80582
80623
|
reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
|
|
80583
80624
|
return booleanType;
|
|
80584
80625
|
case 102 /* SyntaxKind.InstanceOfKeyword */:
|
|
@@ -80784,6 +80825,26 @@ var ts;
|
|
|
80784
80825
|
return undefined;
|
|
80785
80826
|
}
|
|
80786
80827
|
}
|
|
80828
|
+
function checkNaNEquality(errorNode, operator, left, right) {
|
|
80829
|
+
var isLeftNaN = isGlobalNaN(ts.skipParentheses(left));
|
|
80830
|
+
var isRightNaN = isGlobalNaN(ts.skipParentheses(right));
|
|
80831
|
+
if (isLeftNaN || isRightNaN) {
|
|
80832
|
+
var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */));
|
|
80833
|
+
if (isLeftNaN && isRightNaN)
|
|
80834
|
+
return;
|
|
80835
|
+
var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : "";
|
|
80836
|
+
var location = isLeftNaN ? right : left;
|
|
80837
|
+
var expression = ts.skipParentheses(location);
|
|
80838
|
+
ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")")));
|
|
80839
|
+
}
|
|
80840
|
+
}
|
|
80841
|
+
function isGlobalNaN(expr) {
|
|
80842
|
+
if (ts.isIdentifier(expr) && expr.escapedText === "NaN") {
|
|
80843
|
+
var globalNaNSymbol = getGlobalNaNSymbol();
|
|
80844
|
+
return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr);
|
|
80845
|
+
}
|
|
80846
|
+
return false;
|
|
80847
|
+
}
|
|
80787
80848
|
}
|
|
80788
80849
|
function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
|
|
80789
80850
|
var effectiveLeft = leftType;
|
|
@@ -81821,7 +81882,7 @@ var ts;
|
|
|
81821
81882
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81822
81883
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81823
81884
|
var indexSignatureMap_1 = new ts.Map();
|
|
81824
|
-
var
|
|
81885
|
+
var _loop_30 = function (declaration) {
|
|
81825
81886
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81826
81887
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81827
81888
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81836,7 +81897,7 @@ var ts;
|
|
|
81836
81897
|
};
|
|
81837
81898
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81838
81899
|
var declaration = _a[_i];
|
|
81839
|
-
|
|
81900
|
+
_loop_30(declaration);
|
|
81840
81901
|
}
|
|
81841
81902
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81842
81903
|
if (entry.declarations.length > 1) {
|
|
@@ -85436,7 +85497,7 @@ var ts;
|
|
|
85436
85497
|
var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
|
|
85437
85498
|
name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
|
|
85438
85499
|
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
85439
|
-
var
|
|
85500
|
+
var _loop_31 = function (info) {
|
|
85440
85501
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
85441
85502
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
85442
85503
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -85453,7 +85514,7 @@ var ts;
|
|
|
85453
85514
|
};
|
|
85454
85515
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
85455
85516
|
var info = indexInfos_9[_i];
|
|
85456
|
-
|
|
85517
|
+
_loop_31(info);
|
|
85457
85518
|
}
|
|
85458
85519
|
}
|
|
85459
85520
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -85461,7 +85522,7 @@ var ts;
|
|
|
85461
85522
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
85462
85523
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
|
|
85463
85524
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
85464
|
-
var
|
|
85525
|
+
var _loop_32 = function (info) {
|
|
85465
85526
|
if (info === checkInfo)
|
|
85466
85527
|
return "continue";
|
|
85467
85528
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -85476,7 +85537,7 @@ var ts;
|
|
|
85476
85537
|
};
|
|
85477
85538
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
85478
85539
|
var info = indexInfos_10[_i];
|
|
85479
|
-
|
|
85540
|
+
_loop_32(info);
|
|
85480
85541
|
}
|
|
85481
85542
|
}
|
|
85482
85543
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85796,7 +85857,7 @@ var ts;
|
|
|
85796
85857
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85797
85858
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85798
85859
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85799
|
-
var
|
|
85860
|
+
var _loop_33 = function (member) {
|
|
85800
85861
|
if (ts.hasAmbientModifier(member)) {
|
|
85801
85862
|
return "continue";
|
|
85802
85863
|
}
|
|
@@ -85813,7 +85874,7 @@ var ts;
|
|
|
85813
85874
|
};
|
|
85814
85875
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85815
85876
|
var member = _a[_i];
|
|
85816
|
-
|
|
85877
|
+
_loop_33(member);
|
|
85817
85878
|
}
|
|
85818
85879
|
}
|
|
85819
85880
|
/**
|
|
@@ -85901,7 +85962,7 @@ var ts;
|
|
|
85901
85962
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85902
85963
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
85903
85964
|
var issuedMemberError = false;
|
|
85904
|
-
var
|
|
85965
|
+
var _loop_34 = function (member) {
|
|
85905
85966
|
if (ts.isStatic(member)) {
|
|
85906
85967
|
return "continue";
|
|
85907
85968
|
}
|
|
@@ -85920,7 +85981,7 @@ var ts;
|
|
|
85920
85981
|
};
|
|
85921
85982
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85922
85983
|
var member = _a[_i];
|
|
85923
|
-
|
|
85984
|
+
_loop_34(member);
|
|
85924
85985
|
}
|
|
85925
85986
|
if (!issuedMemberError) {
|
|
85926
85987
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85991,7 +86052,7 @@ var ts;
|
|
|
85991
86052
|
var _a, _b, _c, _d;
|
|
85992
86053
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85993
86054
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85994
|
-
var
|
|
86055
|
+
var _loop_35 = function (baseProperty) {
|
|
85995
86056
|
var base = getTargetSymbol(baseProperty);
|
|
85996
86057
|
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
|
|
85997
86058
|
return "continue";
|
|
@@ -86101,8 +86162,8 @@ var ts;
|
|
|
86101
86162
|
};
|
|
86102
86163
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
86103
86164
|
var baseProperty = baseProperties_1[_i];
|
|
86104
|
-
var
|
|
86105
|
-
switch (
|
|
86165
|
+
var state_11 = _loop_35(baseProperty);
|
|
86166
|
+
switch (state_11) {
|
|
86106
86167
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
86107
86168
|
}
|
|
86108
86169
|
}
|
|
@@ -115343,6 +115404,7 @@ var ts;
|
|
|
115343
115404
|
writeTrailingSemicolon();
|
|
115344
115405
|
}
|
|
115345
115406
|
function emitExportDeclaration(node) {
|
|
115407
|
+
emitModifiers(node, node.modifiers);
|
|
115346
115408
|
var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node);
|
|
115347
115409
|
writeSpace();
|
|
115348
115410
|
if (node.isTypeOnly) {
|
|
@@ -123826,17 +123888,13 @@ var ts;
|
|
|
123826
123888
|
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
123827
123889
|
return !!value && !!value.length;
|
|
123828
123890
|
}
|
|
123829
|
-
function createHasInvalidatedResolution(
|
|
123891
|
+
function createHasInvalidatedResolution(userProvidedHasInvalidatedResolution) {
|
|
123830
123892
|
// Ensure pending resolutions are applied
|
|
123831
123893
|
invalidateResolutionsOfFailedLookupLocations();
|
|
123832
|
-
if (forceAllFilesAsInvalidated) {
|
|
123833
|
-
// Any file asked would have invalidated resolution
|
|
123834
|
-
filesWithInvalidatedResolutions = undefined;
|
|
123835
|
-
return ts.returnTrue;
|
|
123836
|
-
}
|
|
123837
123894
|
var collected = filesWithInvalidatedResolutions;
|
|
123838
123895
|
filesWithInvalidatedResolutions = undefined;
|
|
123839
|
-
return function (path) { return (
|
|
123896
|
+
return function (path) { return (userProvidedHasInvalidatedResolution === null || userProvidedHasInvalidatedResolution === void 0 ? void 0 : userProvidedHasInvalidatedResolution(path)) ||
|
|
123897
|
+
!!(collected === null || collected === void 0 ? void 0 : collected.has(path)) ||
|
|
123840
123898
|
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
123841
123899
|
}
|
|
123842
123900
|
function startCachingPerDirectoryResolution() {
|
|
@@ -124945,7 +125003,7 @@ var ts;
|
|
|
124945
125003
|
});
|
|
124946
125004
|
// Sort by paths closest to importing file Name directory
|
|
124947
125005
|
var sortedPaths = [];
|
|
124948
|
-
var
|
|
125006
|
+
var _loop_36 = function (directory) {
|
|
124949
125007
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
124950
125008
|
var pathsInDirectory;
|
|
124951
125009
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -124969,9 +125027,9 @@ var ts;
|
|
|
124969
125027
|
};
|
|
124970
125028
|
var out_directory_1;
|
|
124971
125029
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
124972
|
-
var
|
|
125030
|
+
var state_12 = _loop_36(directory);
|
|
124973
125031
|
directory = out_directory_1;
|
|
124974
|
-
if (
|
|
125032
|
+
if (state_12 === "break")
|
|
124975
125033
|
break;
|
|
124976
125034
|
}
|
|
124977
125035
|
if (allFileNames.size) {
|
|
@@ -125040,7 +125098,7 @@ var ts;
|
|
|
125040
125098
|
}
|
|
125041
125099
|
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
125042
125100
|
for (var key in paths) {
|
|
125043
|
-
var
|
|
125101
|
+
var _loop_37 = function (patternText_1) {
|
|
125044
125102
|
var pattern = ts.normalizePath(patternText_1);
|
|
125045
125103
|
var indexOfStar = pattern.indexOf("*");
|
|
125046
125104
|
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
|
|
@@ -125107,9 +125165,9 @@ var ts;
|
|
|
125107
125165
|
};
|
|
125108
125166
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
125109
125167
|
var patternText_1 = _a[_i];
|
|
125110
|
-
var
|
|
125111
|
-
if (typeof
|
|
125112
|
-
return
|
|
125168
|
+
var state_13 = _loop_37(patternText_1);
|
|
125169
|
+
if (typeof state_13 === "object")
|
|
125170
|
+
return state_13.value;
|
|
125113
125171
|
}
|
|
125114
125172
|
}
|
|
125115
125173
|
function validateEnding(_a) {
|
|
@@ -126216,6 +126274,7 @@ var ts;
|
|
|
126216
126274
|
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
126217
126275
|
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
126218
126276
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
126277
|
+
var userProvidedHasInvalidatedResolution = ts.maybeBind(host, host.hasInvalidatedResolution) || ts.returnTrue;
|
|
126219
126278
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
126220
126279
|
synchronizeProgram();
|
|
126221
126280
|
// Update the wild card directory watch
|
|
@@ -126282,7 +126341,7 @@ var ts;
|
|
|
126282
126341
|
}
|
|
126283
126342
|
}
|
|
126284
126343
|
// All resolutions are invalid if user provided resolutions
|
|
126285
|
-
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
126344
|
+
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution ? userProvidedHasInvalidatedResolution : undefined);
|
|
126286
126345
|
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
126287
126346
|
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
126288
126347
|
if (hasChangedConfigFileParsingErrors) {
|
|
@@ -135448,7 +135507,7 @@ var ts;
|
|
|
135448
135507
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
135449
135508
|
}
|
|
135450
135509
|
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
135451
|
-
var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag,
|
|
135510
|
+
var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports;
|
|
135452
135511
|
// Verify if the file is JSX language variant
|
|
135453
135512
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) {
|
|
135454
135513
|
var completionInfo = getJsxClosingTagCompletion(location, sourceFile);
|
|
@@ -135462,7 +135521,7 @@ var ts;
|
|
|
135462
135521
|
return undefined;
|
|
135463
135522
|
}
|
|
135464
135523
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
135465
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer,
|
|
135524
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
135466
135525
|
if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) {
|
|
135467
135526
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
135468
135527
|
var keywordEntry = _a[_i];
|
|
@@ -135580,7 +135639,7 @@ var ts;
|
|
|
135580
135639
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
135581
135640
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority };
|
|
135582
135641
|
}
|
|
135583
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
135642
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
135584
135643
|
var _a, _b;
|
|
135585
135644
|
var insertText;
|
|
135586
135645
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
@@ -135636,8 +135695,8 @@ var ts;
|
|
|
135636
135695
|
}
|
|
135637
135696
|
if (originIsResolvedExport(origin)) {
|
|
135638
135697
|
sourceDisplay = [ts.textPart(origin.moduleSpecifier)];
|
|
135639
|
-
if (
|
|
135640
|
-
(_a = getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
135698
|
+
if (importStatementCompletion) {
|
|
135699
|
+
(_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
|
|
135641
135700
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
135642
135701
|
}
|
|
135643
135702
|
}
|
|
@@ -135692,7 +135751,7 @@ var ts;
|
|
|
135692
135751
|
}
|
|
135693
135752
|
if (originIsExport(origin) || originIsResolvedExport(origin)) {
|
|
135694
135753
|
data = originToCompletionEntryData(origin);
|
|
135695
|
-
hasAction = !
|
|
135754
|
+
hasAction = !importStatementCompletion;
|
|
135696
135755
|
}
|
|
135697
135756
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
135698
135757
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
@@ -135715,7 +135774,7 @@ var ts;
|
|
|
135715
135774
|
labelDetails: labelDetails,
|
|
135716
135775
|
isSnippet: isSnippet,
|
|
135717
135776
|
isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
|
|
135718
|
-
isImportStatementCompletion: !!
|
|
135777
|
+
isImportStatementCompletion: !!importStatementCompletion || undefined,
|
|
135719
135778
|
data: data,
|
|
135720
135779
|
};
|
|
135721
135780
|
}
|
|
@@ -136087,19 +136146,16 @@ var ts;
|
|
|
136087
136146
|
};
|
|
136088
136147
|
return unresolvedOrigin;
|
|
136089
136148
|
}
|
|
136090
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
136091
|
-
var
|
|
136092
|
-
var sourceFile = importCompletionNode.getSourceFile();
|
|
136093
|
-
var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile);
|
|
136149
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
136150
|
+
var replacementSpan = importStatementCompletion.replacementSpan;
|
|
136094
136151
|
var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
136095
136152
|
var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ :
|
|
136096
136153
|
origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ :
|
|
136097
136154
|
0 /* ExportKind.Named */;
|
|
136098
136155
|
var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
136099
136156
|
var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true);
|
|
136100
|
-
var
|
|
136101
|
-
var
|
|
136102
|
-
var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
136157
|
+
var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier;
|
|
136158
|
+
var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
136103
136159
|
var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : "";
|
|
136104
136160
|
var suffix = useSemicolons ? ";" : "";
|
|
136105
136161
|
switch (importKind) {
|
|
@@ -136133,7 +136189,7 @@ var ts;
|
|
|
136133
136189
|
return CompletionSource.TypeOnlyAlias;
|
|
136134
136190
|
}
|
|
136135
136191
|
}
|
|
136136
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer,
|
|
136192
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
136137
136193
|
var _a;
|
|
136138
136194
|
var start = ts.timestamp();
|
|
136139
136195
|
var variableDeclaration = getVariableDeclaration(location);
|
|
@@ -136154,7 +136210,7 @@ var ts;
|
|
|
136154
136210
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
136155
136211
|
var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority;
|
|
136156
136212
|
var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText);
|
|
136157
|
-
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
136213
|
+
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
136158
136214
|
if (!entry) {
|
|
136159
136215
|
continue;
|
|
136160
136216
|
}
|
|
@@ -136345,7 +136401,7 @@ var ts;
|
|
|
136345
136401
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
136346
136402
|
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
|
|
136347
136403
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
136348
|
-
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).
|
|
136404
|
+
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
|
|
136349
136405
|
// Import statement completion: 'import c|'
|
|
136350
136406
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
136351
136407
|
}
|
|
@@ -136546,34 +136602,34 @@ var ts;
|
|
|
136546
136602
|
var isStartingCloseTag = false;
|
|
136547
136603
|
var isJsxInitializer = false;
|
|
136548
136604
|
var isJsxIdentifierExpected = false;
|
|
136549
|
-
var
|
|
136605
|
+
var importStatementCompletion;
|
|
136550
136606
|
var location = ts.getTouchingPropertyName(sourceFile, position);
|
|
136551
136607
|
var keywordFilters = 0 /* KeywordCompletionFilters.None */;
|
|
136552
136608
|
var isNewIdentifierLocation = false;
|
|
136553
136609
|
var flags = 0 /* CompletionInfoFlags.None */;
|
|
136554
136610
|
if (contextToken) {
|
|
136555
|
-
var
|
|
136556
|
-
|
|
136557
|
-
|
|
136558
|
-
if (importStatementCompletion.isKeywordOnlyCompletion) {
|
|
136611
|
+
var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
|
|
136612
|
+
if (importStatementCompletionInfo.keywordCompletion) {
|
|
136613
|
+
if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
|
|
136559
136614
|
return {
|
|
136560
136615
|
kind: 4 /* CompletionDataKind.Keywords */,
|
|
136561
|
-
keywordCompletions: [keywordToCompletionEntry(
|
|
136562
|
-
isNewIdentifierLocation: isNewIdentifierLocation,
|
|
136616
|
+
keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)],
|
|
136617
|
+
isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation,
|
|
136563
136618
|
};
|
|
136564
136619
|
}
|
|
136565
|
-
keywordFilters = keywordFiltersFromSyntaxKind(
|
|
136620
|
+
keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion);
|
|
136566
136621
|
}
|
|
136567
|
-
if (
|
|
136622
|
+
if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
|
|
136568
136623
|
// Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
|
|
136569
136624
|
// added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
|
|
136570
136625
|
// is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
|
|
136571
136626
|
// to opt in with the `includeCompletionsForImportStatements` user preference.
|
|
136572
|
-
importCompletionNode = importStatementCompletion.replacementNode;
|
|
136573
136627
|
flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */;
|
|
136628
|
+
importStatementCompletion = importStatementCompletionInfo;
|
|
136629
|
+
isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
|
|
136574
136630
|
}
|
|
136575
136631
|
// Bail out if this is a known invalid completion location
|
|
136576
|
-
if (!
|
|
136632
|
+
if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
|
|
136577
136633
|
log("Returning an empty list because completion was requested in an invalid position.");
|
|
136578
136634
|
return keywordFilters
|
|
136579
136635
|
? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation())
|
|
@@ -136619,7 +136675,7 @@ var ts;
|
|
|
136619
136675
|
return undefined;
|
|
136620
136676
|
}
|
|
136621
136677
|
}
|
|
136622
|
-
else if (!
|
|
136678
|
+
else if (!importStatementCompletion) {
|
|
136623
136679
|
// <UI.Test /* completion position */ />
|
|
136624
136680
|
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
|
|
136625
136681
|
// Then, try to get a JSX container and its associated attributes type.
|
|
@@ -136762,7 +136818,7 @@ var ts;
|
|
|
136762
136818
|
isTypeOnlyLocation: isTypeOnlyLocation,
|
|
136763
136819
|
isJsxIdentifierExpected: isJsxIdentifierExpected,
|
|
136764
136820
|
isRightOfOpenTag: isRightOfOpenTag,
|
|
136765
|
-
|
|
136821
|
+
importStatementCompletion: importStatementCompletion,
|
|
136766
136822
|
hasUnresolvedAutoImports: hasUnresolvedAutoImports,
|
|
136767
136823
|
flags: flags,
|
|
136768
136824
|
};
|
|
@@ -137016,7 +137072,7 @@ var ts;
|
|
|
137016
137072
|
return 1 /* GlobalsSearch.Success */;
|
|
137017
137073
|
}
|
|
137018
137074
|
function tryGetImportCompletionSymbols() {
|
|
137019
|
-
if (!
|
|
137075
|
+
if (!importStatementCompletion)
|
|
137020
137076
|
return 0 /* GlobalsSearch.Continue */;
|
|
137021
137077
|
isNewIdentifierLocation = true;
|
|
137022
137078
|
collectAutoImports();
|
|
@@ -137099,7 +137155,7 @@ var ts;
|
|
|
137099
137155
|
}
|
|
137100
137156
|
function shouldOfferImportCompletions() {
|
|
137101
137157
|
// If already typing an import statement, provide completions for it.
|
|
137102
|
-
if (
|
|
137158
|
+
if (importStatementCompletion)
|
|
137103
137159
|
return true;
|
|
137104
137160
|
// If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
|
|
137105
137161
|
if (isNonContextualObjectLiteral)
|
|
@@ -137129,7 +137185,7 @@ var ts;
|
|
|
137129
137185
|
}
|
|
137130
137186
|
function isTypeOnlyCompletion() {
|
|
137131
137187
|
return insideJsDocTagTypeExpression
|
|
137132
|
-
|| !!
|
|
137188
|
+
|| !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
|
|
137133
137189
|
|| !isContextTokenValueLocation(contextToken) &&
|
|
137134
137190
|
(ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
|
|
137135
137191
|
|| ts.isPartOfTypeNode(location)
|
|
@@ -137179,8 +137235,7 @@ var ts;
|
|
|
137179
137235
|
flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */;
|
|
137180
137236
|
// import { type | -> token text should be blank
|
|
137181
137237
|
var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
|
|
137182
|
-
&&
|
|
137183
|
-
&& couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
|
|
137238
|
+
&& importStatementCompletion;
|
|
137184
137239
|
var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" :
|
|
137185
137240
|
previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() :
|
|
137186
137241
|
"";
|
|
@@ -137188,14 +137243,14 @@ var ts;
|
|
|
137188
137243
|
var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken);
|
|
137189
137244
|
var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
137190
137245
|
var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
137191
|
-
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!
|
|
137246
|
+
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
137192
137247
|
exportInfo.search(sourceFile.path,
|
|
137193
137248
|
/*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
|
|
137194
137249
|
if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
|
|
137195
137250
|
return false;
|
|
137196
137251
|
if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
|
|
137197
137252
|
return false;
|
|
137198
|
-
if (!isTypeOnlyLocation && !
|
|
137253
|
+
if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */))
|
|
137199
137254
|
return false;
|
|
137200
137255
|
if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */)))
|
|
137201
137256
|
return false;
|
|
@@ -137276,7 +137331,7 @@ var ts;
|
|
|
137276
137331
|
return;
|
|
137277
137332
|
}
|
|
137278
137333
|
symbolToOriginInfoMap[symbols.length] = origin;
|
|
137279
|
-
symbolToSortTextMap[symbolId] =
|
|
137334
|
+
symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
|
|
137280
137335
|
symbols.push(symbol);
|
|
137281
137336
|
}
|
|
137282
137337
|
/* Mutates `symbols` and `symbolToOriginInfoMap`. */
|
|
@@ -138543,6 +138598,7 @@ var ts;
|
|
|
138543
138598
|
return undefined;
|
|
138544
138599
|
}
|
|
138545
138600
|
function getImportStatementCompletionInfo(contextToken) {
|
|
138601
|
+
var _a, _b, _c;
|
|
138546
138602
|
var keywordCompletion;
|
|
138547
138603
|
var isKeywordOnlyCompletion = false;
|
|
138548
138604
|
var candidate = getCandidate();
|
|
@@ -138550,9 +138606,9 @@ var ts;
|
|
|
138550
138606
|
isKeywordOnlyCompletion: isKeywordOnlyCompletion,
|
|
138551
138607
|
keywordCompletion: keywordCompletion,
|
|
138552
138608
|
isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */),
|
|
138553
|
-
|
|
138554
|
-
|
|
138555
|
-
|
|
138609
|
+
isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly),
|
|
138610
|
+
couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken),
|
|
138611
|
+
replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate),
|
|
138556
138612
|
};
|
|
138557
138613
|
function getCandidate() {
|
|
138558
138614
|
var parent = contextToken.parent;
|
|
@@ -138594,14 +138650,71 @@ var ts;
|
|
|
138594
138650
|
return undefined;
|
|
138595
138651
|
}
|
|
138596
138652
|
}
|
|
138653
|
+
function getSingleLineReplacementSpanForImportCompletionNode(node) {
|
|
138654
|
+
var _a, _b, _c;
|
|
138655
|
+
if (!node)
|
|
138656
|
+
return undefined;
|
|
138657
|
+
var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node;
|
|
138658
|
+
var sourceFile = top.getSourceFile();
|
|
138659
|
+
if (ts.rangeIsOnSingleLine(top, sourceFile)) {
|
|
138660
|
+
return ts.createTextSpanFromNode(top, sourceFile);
|
|
138661
|
+
}
|
|
138662
|
+
// ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration
|
|
138663
|
+
ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */);
|
|
138664
|
+
// Guess which point in the import might actually be a later statement parsed as part of the import
|
|
138665
|
+
// during parser recovery - either in the middle of named imports, or the module specifier.
|
|
138666
|
+
var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */
|
|
138667
|
+
? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier
|
|
138668
|
+
: top.moduleReference;
|
|
138669
|
+
var withoutModuleSpecifier = {
|
|
138670
|
+
pos: top.getFirstToken().getStart(),
|
|
138671
|
+
end: potentialSplitPoint.pos,
|
|
138672
|
+
};
|
|
138673
|
+
// The module specifier/reference was previously found to be missing, empty, or
|
|
138674
|
+
// not a string literal - in this last case, it's likely that statement on a following
|
|
138675
|
+
// line was parsed as the module specifier of a partially-typed import, e.g.
|
|
138676
|
+
// import Foo|
|
|
138677
|
+
// interface Blah {}
|
|
138678
|
+
// This appears to be a multiline-import, and editors can't replace multiple lines.
|
|
138679
|
+
// But if everything but the "module specifier" is on one line, by this point we can
|
|
138680
|
+
// assume that the "module specifier" is actually just another statement, and return
|
|
138681
|
+
// the single-line range of the import excluding that probable statement.
|
|
138682
|
+
if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) {
|
|
138683
|
+
return ts.createTextSpanFromRange(withoutModuleSpecifier);
|
|
138684
|
+
}
|
|
138685
|
+
}
|
|
138686
|
+
// Tries to identify the first named import that is not really a named import, but rather
|
|
138687
|
+
// just parser recovery for a situation like:
|
|
138688
|
+
// import { Foo|
|
|
138689
|
+
// interface Bar {}
|
|
138690
|
+
// in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller
|
|
138691
|
+
// will also check if this token is on a separate line from the rest of the import.
|
|
138692
|
+
function getPotentiallyInvalidImportSpecifier(namedBindings) {
|
|
138693
|
+
var _a;
|
|
138694
|
+
return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) {
|
|
138695
|
+
var _a;
|
|
138696
|
+
return !e.propertyName &&
|
|
138697
|
+
ts.isStringANonContextualKeyword(e.name.text) &&
|
|
138698
|
+
((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */;
|
|
138699
|
+
});
|
|
138700
|
+
}
|
|
138597
138701
|
function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) {
|
|
138598
138702
|
return ts.isImportSpecifier(importSpecifier)
|
|
138599
138703
|
&& (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken));
|
|
138600
138704
|
}
|
|
138601
138705
|
function canCompleteFromNamedBindings(namedBindings) {
|
|
138602
|
-
|
|
138603
|
-
|
|
138604
|
-
|
|
138706
|
+
if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) {
|
|
138707
|
+
return false;
|
|
138708
|
+
}
|
|
138709
|
+
if (ts.isNamedImports(namedBindings)) {
|
|
138710
|
+
// We can only complete on named imports if there are no other named imports already,
|
|
138711
|
+
// but parser recovery sometimes puts later statements in the named imports list, so
|
|
138712
|
+
// we try to only consider the probably-valid ones.
|
|
138713
|
+
var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings);
|
|
138714
|
+
var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length;
|
|
138715
|
+
return validImports < 2;
|
|
138716
|
+
}
|
|
138717
|
+
return true;
|
|
138605
138718
|
}
|
|
138606
138719
|
function isModuleSpecifierMissingOrEmpty(specifier) {
|
|
138607
138720
|
var _a;
|
|
@@ -146636,6 +146749,10 @@ var ts;
|
|
|
146636
146749
|
pushSelectionCommentRange(comment.pos, comment.end);
|
|
146637
146750
|
}
|
|
146638
146751
|
if (positionShouldSnapToNode(sourceFile, pos, node)) {
|
|
146752
|
+
if (ts.isFunctionBody(node)
|
|
146753
|
+
&& ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) {
|
|
146754
|
+
pushSelectionRange(node.getStart(sourceFile), node.getEnd());
|
|
146755
|
+
}
|
|
146639
146756
|
// 1. Blocks are effectively redundant with SyntaxLists.
|
|
146640
146757
|
// 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
|
|
146641
146758
|
// of things that should be considered independently.
|
|
@@ -157334,7 +157451,7 @@ var ts;
|
|
|
157334
157451
|
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
|
|
157335
157452
|
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
157336
157453
|
return;
|
|
157337
|
-
var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157454
|
+
var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157338
157455
|
if (declaration === undefined)
|
|
157339
157456
|
return;
|
|
157340
157457
|
if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) {
|
|
@@ -157368,14 +157485,6 @@ var ts;
|
|
|
157368
157485
|
}
|
|
157369
157486
|
}
|
|
157370
157487
|
}
|
|
157371
|
-
function findAncestorMatchingSpan(sourceFile, span) {
|
|
157372
|
-
var end = ts.textSpanEnd(span);
|
|
157373
|
-
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
157374
|
-
while (token.end < end) {
|
|
157375
|
-
token = token.parent;
|
|
157376
|
-
}
|
|
157377
|
-
return token;
|
|
157378
|
-
}
|
|
157379
157488
|
function tryGetConstraintFromDiagnosticMessage(messageText) {
|
|
157380
157489
|
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1];
|
|
157381
157490
|
return constraint;
|
|
@@ -158256,7 +158365,7 @@ var ts;
|
|
|
158256
158365
|
return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
158257
158366
|
}
|
|
158258
158367
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
158259
|
-
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
158368
|
+
if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
158260
158369
|
return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
|
|
158261
158370
|
}
|
|
158262
158371
|
return undefined;
|
|
@@ -158921,6 +159030,63 @@ var ts;
|
|
|
158921
159030
|
})(ts || (ts = {}));
|
|
158922
159031
|
/* @internal */
|
|
158923
159032
|
var ts;
|
|
159033
|
+
(function (ts) {
|
|
159034
|
+
var codefix;
|
|
159035
|
+
(function (codefix) {
|
|
159036
|
+
var fixId = "fixNaNEquality";
|
|
159037
|
+
var errorCodes = [
|
|
159038
|
+
ts.Diagnostics.This_condition_will_always_return_0.code,
|
|
159039
|
+
];
|
|
159040
|
+
codefix.registerCodeFix({
|
|
159041
|
+
errorCodes: errorCodes,
|
|
159042
|
+
getCodeActions: function (context) {
|
|
159043
|
+
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
159044
|
+
var info = getInfo(program, sourceFile, span);
|
|
159045
|
+
if (info === undefined)
|
|
159046
|
+
return;
|
|
159047
|
+
var suggestion = info.suggestion, expression = info.expression, arg = info.arg;
|
|
159048
|
+
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); });
|
|
159049
|
+
return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
159050
|
+
},
|
|
159051
|
+
fixIds: [fixId],
|
|
159052
|
+
getAllCodeActions: function (context) {
|
|
159053
|
+
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
159054
|
+
var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length));
|
|
159055
|
+
if (info) {
|
|
159056
|
+
doChange(changes, diag.file, info.arg, info.expression);
|
|
159057
|
+
}
|
|
159058
|
+
});
|
|
159059
|
+
}
|
|
159060
|
+
});
|
|
159061
|
+
function getInfo(program, sourceFile, span) {
|
|
159062
|
+
var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
|
|
159063
|
+
if (diag === undefined || diag.relatedInformation === undefined)
|
|
159064
|
+
return;
|
|
159065
|
+
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; });
|
|
159066
|
+
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
159067
|
+
return;
|
|
159068
|
+
var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
159069
|
+
if (token === undefined)
|
|
159070
|
+
return;
|
|
159071
|
+
if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) {
|
|
159072
|
+
return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token };
|
|
159073
|
+
}
|
|
159074
|
+
return undefined;
|
|
159075
|
+
}
|
|
159076
|
+
function doChange(changes, sourceFile, arg, expression) {
|
|
159077
|
+
var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]);
|
|
159078
|
+
var operator = expression.operatorToken.kind;
|
|
159079
|
+
changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */
|
|
159080
|
+
? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression);
|
|
159081
|
+
}
|
|
159082
|
+
function getSuggestion(messageText) {
|
|
159083
|
+
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1];
|
|
159084
|
+
return suggestion;
|
|
159085
|
+
}
|
|
159086
|
+
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
159087
|
+
})(ts || (ts = {}));
|
|
159088
|
+
/* @internal */
|
|
159089
|
+
var ts;
|
|
158924
159090
|
(function (ts) {
|
|
158925
159091
|
var codefix;
|
|
158926
159092
|
(function (codefix) {
|
|
@@ -161638,6 +161804,15 @@ var ts;
|
|
|
161638
161804
|
symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); });
|
|
161639
161805
|
}
|
|
161640
161806
|
codefix.importSymbols = importSymbols;
|
|
161807
|
+
function findAncestorMatchingSpan(sourceFile, span) {
|
|
161808
|
+
var end = ts.textSpanEnd(span);
|
|
161809
|
+
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
161810
|
+
while (token.end < end) {
|
|
161811
|
+
token = token.parent;
|
|
161812
|
+
}
|
|
161813
|
+
return token;
|
|
161814
|
+
}
|
|
161815
|
+
codefix.findAncestorMatchingSpan = findAncestorMatchingSpan;
|
|
161641
161816
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
161642
161817
|
})(ts || (ts = {}));
|
|
161643
161818
|
/* @internal */
|