@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/tsserverlibrary.js
CHANGED
|
@@ -108,7 +108,7 @@ var ts;
|
|
|
108
108
|
// The following is baselined as a literal template type without intervention
|
|
109
109
|
/** The version of the TypeScript compiler release */
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
111
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.
|
|
111
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220922");
|
|
112
112
|
/* @internal */
|
|
113
113
|
var Comparison;
|
|
114
114
|
(function (Comparison) {
|
|
@@ -3017,7 +3017,7 @@ var ts;
|
|
|
3017
3017
|
];
|
|
3018
3018
|
for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
|
|
3019
3019
|
var ctor = nodeConstructors_1[_i];
|
|
3020
|
-
if (!ts.hasProperty(ctor, "__debugKind")) {
|
|
3020
|
+
if (!ts.hasProperty(ctor.prototype, "__debugKind")) {
|
|
3021
3021
|
Object.defineProperties(ctor.prototype, {
|
|
3022
3022
|
// for use with vscode-js-debug's new customDescriptionGenerator in launch.json
|
|
3023
3023
|
__tsDebuggerDisplay: {
|
|
@@ -9132,6 +9132,7 @@ var ts;
|
|
|
9132
9132
|
_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?"),
|
|
9133
9133
|
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."),
|
|
9134
9134
|
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."),
|
|
9135
|
+
This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
9135
9136
|
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}'."),
|
|
9136
9137
|
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}'."),
|
|
9137
9138
|
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}'."),
|
|
@@ -10074,6 +10075,8 @@ var ts;
|
|
|
10074
10075
|
Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
|
|
10075
10076
|
Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
|
|
10076
10077
|
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}'"),
|
|
10078
|
+
Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."),
|
|
10079
|
+
Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
10077
10080
|
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."),
|
|
10078
10081
|
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'."),
|
|
10079
10082
|
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?"),
|
|
@@ -45249,6 +45252,7 @@ var ts;
|
|
|
45249
45252
|
}
|
|
45250
45253
|
}
|
|
45251
45254
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
45255
|
+
var _a;
|
|
45252
45256
|
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
|
|
45253
45257
|
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
|
|
45254
45258
|
var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
@@ -45263,13 +45267,7 @@ var ts;
|
|
|
45263
45267
|
return withPackageId(packageInfo, fromDirectory);
|
|
45264
45268
|
}
|
|
45265
45269
|
}
|
|
45266
|
-
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
45267
45270
|
var loader = function (extensions, candidate, onlyRecordFailures, state) {
|
|
45268
|
-
var _a;
|
|
45269
|
-
// package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
|
|
45270
|
-
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
45271
|
-
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
45272
|
-
}
|
|
45273
45271
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
45274
45272
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths);
|
|
45275
45273
|
if (!pathAndExtension && packageInfo
|
|
@@ -45282,19 +45280,24 @@ var ts;
|
|
|
45282
45280
|
}
|
|
45283
45281
|
return withPackageId(packageInfo, pathAndExtension);
|
|
45284
45282
|
};
|
|
45285
|
-
|
|
45286
|
-
|
|
45287
|
-
|
|
45283
|
+
var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest;
|
|
45284
|
+
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
|
|
45285
|
+
if (rest !== "") {
|
|
45286
|
+
// Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now.
|
|
45288
45287
|
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
45289
|
-
|
|
45290
|
-
|
|
45291
|
-
|
|
45292
|
-
|
|
45293
|
-
|
|
45294
|
-
|
|
45295
|
-
|
|
45296
|
-
|
|
45297
|
-
|
|
45288
|
+
}
|
|
45289
|
+
// package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them)
|
|
45290
|
+
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
45291
|
+
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
45292
|
+
}
|
|
45293
|
+
if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
|
|
45294
|
+
if (state.traceEnabled) {
|
|
45295
|
+
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);
|
|
45296
|
+
}
|
|
45297
|
+
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
|
|
45298
|
+
var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
|
|
45299
|
+
if (fromPaths) {
|
|
45300
|
+
return fromPaths.value;
|
|
45298
45301
|
}
|
|
45299
45302
|
}
|
|
45300
45303
|
return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
@@ -49796,6 +49799,7 @@ var ts;
|
|
|
49796
49799
|
var deferredGlobalOmitSymbol;
|
|
49797
49800
|
var deferredGlobalAwaitedSymbol;
|
|
49798
49801
|
var deferredGlobalBigIntType;
|
|
49802
|
+
var deferredGlobalNaNSymbol;
|
|
49799
49803
|
var deferredGlobalRecordSymbol;
|
|
49800
49804
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49801
49805
|
var flowLoopStart = 0;
|
|
@@ -55474,6 +55478,7 @@ var ts;
|
|
|
55474
55478
|
&& symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */
|
|
55475
55479
|
&& !(symbol.flags & 4194304 /* SymbolFlags.Prototype */)
|
|
55476
55480
|
&& !(symbol.flags & 32 /* SymbolFlags.Class */)
|
|
55481
|
+
&& !(symbol.flags & 8192 /* SymbolFlags.Method */)
|
|
55477
55482
|
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
55478
55483
|
if (propertyAsAlias) {
|
|
55479
55484
|
var createdExport = serializeMaybeAliasAssignment(symbol);
|
|
@@ -60284,7 +60289,7 @@ var ts;
|
|
|
60284
60289
|
var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
|
|
60285
60290
|
// If the symbols are instances of one another with identical types - consider the symbols
|
|
60286
60291
|
// equivalent and just use the first one, which thus allows us to avoid eliding private
|
|
60287
|
-
// members when intersecting a (this-)instantiations of a class with
|
|
60292
|
+
// members when intersecting a (this-)instantiations of a class with its raw base or another instance
|
|
60288
60293
|
if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
|
|
60289
60294
|
// If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
|
|
60290
60295
|
// to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
|
|
@@ -60332,7 +60337,11 @@ var ts;
|
|
|
60332
60337
|
}
|
|
60333
60338
|
}
|
|
60334
60339
|
}
|
|
60335
|
-
if (!singleProp ||
|
|
60340
|
+
if (!singleProp ||
|
|
60341
|
+
isUnion &&
|
|
60342
|
+
(propSet || checkFlags & 48 /* CheckFlags.Partial */) &&
|
|
60343
|
+
checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) &&
|
|
60344
|
+
!(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) {
|
|
60336
60345
|
// No property was found, or, in a union, a property has a private or protected declaration in one
|
|
60337
60346
|
// constituent, but is missing or has a different declaration in another constituent.
|
|
60338
60347
|
return undefined;
|
|
@@ -60434,6 +60443,33 @@ var ts;
|
|
|
60434
60443
|
}
|
|
60435
60444
|
return property;
|
|
60436
60445
|
}
|
|
60446
|
+
function getCommonDeclarationsOfSymbols(symbols) {
|
|
60447
|
+
var commonDeclarations;
|
|
60448
|
+
var _loop_14 = function (symbol) {
|
|
60449
|
+
if (!symbol.declarations) {
|
|
60450
|
+
return { value: undefined };
|
|
60451
|
+
}
|
|
60452
|
+
if (!commonDeclarations) {
|
|
60453
|
+
commonDeclarations = new ts.Set(symbol.declarations);
|
|
60454
|
+
return "continue";
|
|
60455
|
+
}
|
|
60456
|
+
commonDeclarations.forEach(function (declaration) {
|
|
60457
|
+
if (!ts.contains(symbol.declarations, declaration)) {
|
|
60458
|
+
commonDeclarations.delete(declaration);
|
|
60459
|
+
}
|
|
60460
|
+
});
|
|
60461
|
+
if (commonDeclarations.size === 0) {
|
|
60462
|
+
return { value: undefined };
|
|
60463
|
+
}
|
|
60464
|
+
};
|
|
60465
|
+
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
|
|
60466
|
+
var symbol = symbols_3[_i];
|
|
60467
|
+
var state_4 = _loop_14(symbol);
|
|
60468
|
+
if (typeof state_4 === "object")
|
|
60469
|
+
return state_4.value;
|
|
60470
|
+
}
|
|
60471
|
+
return commonDeclarations;
|
|
60472
|
+
}
|
|
60437
60473
|
function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
|
|
60438
60474
|
var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
60439
60475
|
// We need to filter out partial properties in union types
|
|
@@ -61148,7 +61184,7 @@ var ts;
|
|
|
61148
61184
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
61149
61185
|
if (indexSymbol.declarations) {
|
|
61150
61186
|
var indexInfos_4 = [];
|
|
61151
|
-
var
|
|
61187
|
+
var _loop_15 = function (declaration) {
|
|
61152
61188
|
if (declaration.parameters.length === 1) {
|
|
61153
61189
|
var parameter = declaration.parameters[0];
|
|
61154
61190
|
if (parameter.type) {
|
|
@@ -61162,7 +61198,7 @@ var ts;
|
|
|
61162
61198
|
};
|
|
61163
61199
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
61164
61200
|
var declaration = _a[_i];
|
|
61165
|
-
|
|
61201
|
+
_loop_15(declaration);
|
|
61166
61202
|
}
|
|
61167
61203
|
return indexInfos_4;
|
|
61168
61204
|
}
|
|
@@ -61179,7 +61215,7 @@ var ts;
|
|
|
61179
61215
|
var _a;
|
|
61180
61216
|
var inferences;
|
|
61181
61217
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
61182
|
-
var
|
|
61218
|
+
var _loop_16 = function (declaration) {
|
|
61183
61219
|
if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
|
|
61184
61220
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
61185
61221
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -61243,7 +61279,7 @@ var ts;
|
|
|
61243
61279
|
};
|
|
61244
61280
|
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
61245
61281
|
var declaration = _b[_i];
|
|
61246
|
-
|
|
61282
|
+
_loop_16(declaration);
|
|
61247
61283
|
}
|
|
61248
61284
|
}
|
|
61249
61285
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61900,6 +61936,9 @@ var ts;
|
|
|
61900
61936
|
function getGlobalBigIntType() {
|
|
61901
61937
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61902
61938
|
}
|
|
61939
|
+
function getGlobalNaNSymbol() {
|
|
61940
|
+
return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
|
|
61941
|
+
}
|
|
61903
61942
|
function getGlobalRecordSymbol() {
|
|
61904
61943
|
deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61905
61944
|
return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
|
|
@@ -62140,7 +62179,7 @@ var ts;
|
|
|
62140
62179
|
var lastRequiredIndex = -1;
|
|
62141
62180
|
var firstRestIndex = -1;
|
|
62142
62181
|
var lastOptionalOrRestIndex = -1;
|
|
62143
|
-
var
|
|
62182
|
+
var _loop_17 = function (i) {
|
|
62144
62183
|
var type = elementTypes[i];
|
|
62145
62184
|
var flags = target.elementFlags[i];
|
|
62146
62185
|
if (flags & 8 /* ElementFlags.Variadic */) {
|
|
@@ -62170,9 +62209,9 @@ var ts;
|
|
|
62170
62209
|
}
|
|
62171
62210
|
};
|
|
62172
62211
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
62173
|
-
var
|
|
62174
|
-
if (typeof
|
|
62175
|
-
return
|
|
62212
|
+
var state_5 = _loop_17(i);
|
|
62213
|
+
if (typeof state_5 === "object")
|
|
62214
|
+
return state_5.value;
|
|
62176
62215
|
}
|
|
62177
62216
|
// Turn optional elements preceding the last required element into required elements
|
|
62178
62217
|
for (var i = 0; i < lastRequiredIndex; i++) {
|
|
@@ -62200,7 +62239,7 @@ var ts;
|
|
|
62200
62239
|
if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
|
|
62201
62240
|
lastOptionalOrRestIndex = expandedFlags.length;
|
|
62202
62241
|
}
|
|
62203
|
-
expandedTypes.push(type);
|
|
62242
|
+
expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
|
|
62204
62243
|
expandedFlags.push(flags);
|
|
62205
62244
|
if (expandedDeclarations && declaration) {
|
|
62206
62245
|
expandedDeclarations.push(declaration);
|
|
@@ -62366,7 +62405,7 @@ var ts;
|
|
|
62366
62405
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
62367
62406
|
if (templates.length) {
|
|
62368
62407
|
var i = types.length;
|
|
62369
|
-
var
|
|
62408
|
+
var _loop_18 = function () {
|
|
62370
62409
|
i--;
|
|
62371
62410
|
var t = types[i];
|
|
62372
62411
|
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -62374,7 +62413,7 @@ var ts;
|
|
|
62374
62413
|
}
|
|
62375
62414
|
};
|
|
62376
62415
|
while (i > 0) {
|
|
62377
|
-
|
|
62416
|
+
_loop_18();
|
|
62378
62417
|
}
|
|
62379
62418
|
}
|
|
62380
62419
|
}
|
|
@@ -62451,14 +62490,14 @@ var ts;
|
|
|
62451
62490
|
var namedUnions = [];
|
|
62452
62491
|
addNamedUnions(namedUnions, types);
|
|
62453
62492
|
var reducedTypes = [];
|
|
62454
|
-
var
|
|
62493
|
+
var _loop_19 = function (t) {
|
|
62455
62494
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
62456
62495
|
reducedTypes.push(t);
|
|
62457
62496
|
}
|
|
62458
62497
|
};
|
|
62459
62498
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
62460
62499
|
var t = typeSet_1[_i];
|
|
62461
|
-
|
|
62500
|
+
_loop_19(t);
|
|
62462
62501
|
}
|
|
62463
62502
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
62464
62503
|
return namedUnions[0];
|
|
@@ -63688,7 +63727,7 @@ var ts;
|
|
|
63688
63727
|
var result;
|
|
63689
63728
|
var extraTypes;
|
|
63690
63729
|
var tailCount = 0;
|
|
63691
|
-
var
|
|
63730
|
+
var _loop_20 = function () {
|
|
63692
63731
|
if (tailCount === 1000) {
|
|
63693
63732
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63694
63733
|
result = errorType;
|
|
@@ -63809,10 +63848,10 @@ var ts;
|
|
|
63809
63848
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63810
63849
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63811
63850
|
while (true) {
|
|
63812
|
-
var
|
|
63813
|
-
if (typeof
|
|
63814
|
-
return
|
|
63815
|
-
if (
|
|
63851
|
+
var state_6 = _loop_20();
|
|
63852
|
+
if (typeof state_6 === "object")
|
|
63853
|
+
return state_6.value;
|
|
63854
|
+
if (state_6 === "break")
|
|
63816
63855
|
break;
|
|
63817
63856
|
}
|
|
63818
63857
|
return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
|
|
@@ -66427,7 +66466,7 @@ var ts;
|
|
|
66427
66466
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
66428
66467
|
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
|
|
66429
66468
|
}
|
|
66430
|
-
var
|
|
66469
|
+
var _loop_21 = function (prop) {
|
|
66431
66470
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
66432
66471
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
66433
66472
|
if (reportErrors) {
|
|
@@ -66490,9 +66529,9 @@ var ts;
|
|
|
66490
66529
|
};
|
|
66491
66530
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
66492
66531
|
var prop = _b[_i];
|
|
66493
|
-
var
|
|
66494
|
-
if (typeof
|
|
66495
|
-
return
|
|
66532
|
+
var state_7 = _loop_21(prop);
|
|
66533
|
+
if (typeof state_7 === "object")
|
|
66534
|
+
return state_7.value;
|
|
66496
66535
|
}
|
|
66497
66536
|
return false;
|
|
66498
66537
|
}
|
|
@@ -67483,11 +67522,11 @@ var ts;
|
|
|
67483
67522
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
67484
67523
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
67485
67524
|
var matchingTypes = [];
|
|
67486
|
-
var
|
|
67525
|
+
var _loop_22 = function (combination) {
|
|
67487
67526
|
var hasMatch = false;
|
|
67488
67527
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
67489
67528
|
var type = _d[_c];
|
|
67490
|
-
var
|
|
67529
|
+
var _loop_23 = function (i) {
|
|
67491
67530
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
67492
67531
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
67493
67532
|
if (!targetProperty)
|
|
@@ -67503,8 +67542,8 @@ var ts;
|
|
|
67503
67542
|
}
|
|
67504
67543
|
};
|
|
67505
67544
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
67506
|
-
var
|
|
67507
|
-
switch (
|
|
67545
|
+
var state_9 = _loop_23(i);
|
|
67546
|
+
switch (state_9) {
|
|
67508
67547
|
case "continue-outer": continue outer;
|
|
67509
67548
|
}
|
|
67510
67549
|
}
|
|
@@ -67517,9 +67556,9 @@ var ts;
|
|
|
67517
67556
|
};
|
|
67518
67557
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
67519
67558
|
var combination = discriminantCombinations_1[_a];
|
|
67520
|
-
var
|
|
67521
|
-
if (typeof
|
|
67522
|
-
return
|
|
67559
|
+
var state_8 = _loop_22(combination);
|
|
67560
|
+
if (typeof state_8 === "object")
|
|
67561
|
+
return state_8.value;
|
|
67523
67562
|
}
|
|
67524
67563
|
// Compare the remaining non-discriminant properties of each match.
|
|
67525
67564
|
var result = -1 /* Ternary.True */;
|
|
@@ -68224,7 +68263,7 @@ var ts;
|
|
|
68224
68263
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
68225
68264
|
links.variances = ts.emptyArray;
|
|
68226
68265
|
var variances = [];
|
|
68227
|
-
var
|
|
68266
|
+
var _loop_24 = function (tp) {
|
|
68228
68267
|
var modifiers = getVarianceModifiers(tp);
|
|
68229
68268
|
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
|
|
68230
68269
|
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
|
|
@@ -68262,7 +68301,7 @@ var ts;
|
|
|
68262
68301
|
};
|
|
68263
68302
|
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
68264
68303
|
var tp = typeParameters_2[_i];
|
|
68265
|
-
|
|
68304
|
+
_loop_24(tp);
|
|
68266
68305
|
}
|
|
68267
68306
|
links.variances = variances;
|
|
68268
68307
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68854,7 +68893,8 @@ var ts;
|
|
|
68854
68893
|
function getOptionalType(type, isProperty) {
|
|
68855
68894
|
if (isProperty === void 0) { isProperty = false; }
|
|
68856
68895
|
ts.Debug.assert(strictNullChecks);
|
|
68857
|
-
|
|
68896
|
+
var missingOrUndefined = isProperty ? missingType : undefinedType;
|
|
68897
|
+
return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]);
|
|
68858
68898
|
}
|
|
68859
68899
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
68860
68900
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
@@ -70219,7 +70259,7 @@ var ts;
|
|
|
70219
70259
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
70220
70260
|
// succeed. That would be a pointless and confusing outcome.
|
|
70221
70261
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
70222
|
-
var
|
|
70262
|
+
var _loop_25 = function (i) {
|
|
70223
70263
|
var source_1 = matches ? matches[i] : neverType;
|
|
70224
70264
|
var target_3 = types[i];
|
|
70225
70265
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -70269,7 +70309,7 @@ var ts;
|
|
|
70269
70309
|
inferFromTypes(source_1, target_3);
|
|
70270
70310
|
};
|
|
70271
70311
|
for (var i = 0; i < types.length; i++) {
|
|
70272
|
-
|
|
70312
|
+
_loop_25(i);
|
|
70273
70313
|
}
|
|
70274
70314
|
}
|
|
70275
70315
|
}
|
|
@@ -70733,7 +70773,7 @@ var ts;
|
|
|
70733
70773
|
return name;
|
|
70734
70774
|
}
|
|
70735
70775
|
}
|
|
70736
|
-
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
70776
|
+
if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
|
|
70737
70777
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
70738
70778
|
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
70739
70779
|
}
|
|
@@ -70793,7 +70833,7 @@ var ts;
|
|
|
70793
70833
|
function mapTypesByKeyProperty(types, name) {
|
|
70794
70834
|
var map = new ts.Map();
|
|
70795
70835
|
var count = 0;
|
|
70796
|
-
var
|
|
70836
|
+
var _loop_26 = function (type) {
|
|
70797
70837
|
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
|
|
70798
70838
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70799
70839
|
if (discriminant) {
|
|
@@ -70819,9 +70859,9 @@ var ts;
|
|
|
70819
70859
|
};
|
|
70820
70860
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70821
70861
|
var type = types_15[_i];
|
|
70822
|
-
var
|
|
70823
|
-
if (typeof
|
|
70824
|
-
return
|
|
70862
|
+
var state_10 = _loop_26(type);
|
|
70863
|
+
if (typeof state_10 === "object")
|
|
70864
|
+
return state_10.value;
|
|
70825
70865
|
}
|
|
70826
70866
|
return count >= 10 && count * 2 >= types.length ? map : undefined;
|
|
70827
70867
|
}
|
|
@@ -77276,7 +77316,7 @@ var ts;
|
|
|
77276
77316
|
if (spreadIndex >= 0) {
|
|
77277
77317
|
// Create synthetic arguments from spreads of tuple types.
|
|
77278
77318
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
77279
|
-
var
|
|
77319
|
+
var _loop_27 = function (i) {
|
|
77280
77320
|
var arg = args[i];
|
|
77281
77321
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
77282
77322
|
var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -77293,7 +77333,7 @@ var ts;
|
|
|
77293
77333
|
}
|
|
77294
77334
|
};
|
|
77295
77335
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
77296
|
-
|
|
77336
|
+
_loop_27(i);
|
|
77297
77337
|
}
|
|
77298
77338
|
return effectiveArgs_1;
|
|
77299
77339
|
}
|
|
@@ -77622,7 +77662,7 @@ var ts;
|
|
|
77622
77662
|
var min_3 = Number.MAX_VALUE;
|
|
77623
77663
|
var minIndex = 0;
|
|
77624
77664
|
var i_1 = 0;
|
|
77625
|
-
var
|
|
77665
|
+
var _loop_28 = function (c) {
|
|
77626
77666
|
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)); };
|
|
77627
77667
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
|
|
77628
77668
|
if (diags_2) {
|
|
@@ -77640,7 +77680,7 @@ var ts;
|
|
|
77640
77680
|
};
|
|
77641
77681
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
77642
77682
|
var c = candidatesForArgumentError_1[_a];
|
|
77643
|
-
|
|
77683
|
+
_loop_28(c);
|
|
77644
77684
|
}
|
|
77645
77685
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
77646
77686
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77798,7 +77838,7 @@ var ts;
|
|
|
77798
77838
|
}
|
|
77799
77839
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77800
77840
|
var parameters = [];
|
|
77801
|
-
var
|
|
77841
|
+
var _loop_29 = function (i) {
|
|
77802
77842
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77803
77843
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77804
77844
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77806,7 +77846,7 @@ var ts;
|
|
|
77806
77846
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77807
77847
|
};
|
|
77808
77848
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77809
|
-
|
|
77849
|
+
_loop_29(i);
|
|
77810
77850
|
}
|
|
77811
77851
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77812
77852
|
var flags = 0 /* SignatureFlags.None */;
|
|
@@ -80588,6 +80628,7 @@ var ts;
|
|
|
80588
80628
|
var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
|
|
80589
80629
|
error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
80590
80630
|
}
|
|
80631
|
+
checkNaNEquality(errorNode, operator, left, right);
|
|
80591
80632
|
reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
|
|
80592
80633
|
return booleanType;
|
|
80593
80634
|
case 102 /* SyntaxKind.InstanceOfKeyword */:
|
|
@@ -80793,6 +80834,26 @@ var ts;
|
|
|
80793
80834
|
return undefined;
|
|
80794
80835
|
}
|
|
80795
80836
|
}
|
|
80837
|
+
function checkNaNEquality(errorNode, operator, left, right) {
|
|
80838
|
+
var isLeftNaN = isGlobalNaN(ts.skipParentheses(left));
|
|
80839
|
+
var isRightNaN = isGlobalNaN(ts.skipParentheses(right));
|
|
80840
|
+
if (isLeftNaN || isRightNaN) {
|
|
80841
|
+
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 */));
|
|
80842
|
+
if (isLeftNaN && isRightNaN)
|
|
80843
|
+
return;
|
|
80844
|
+
var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : "";
|
|
80845
|
+
var location = isLeftNaN ? right : left;
|
|
80846
|
+
var expression = ts.skipParentheses(location);
|
|
80847
|
+
ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")")));
|
|
80848
|
+
}
|
|
80849
|
+
}
|
|
80850
|
+
function isGlobalNaN(expr) {
|
|
80851
|
+
if (ts.isIdentifier(expr) && expr.escapedText === "NaN") {
|
|
80852
|
+
var globalNaNSymbol = getGlobalNaNSymbol();
|
|
80853
|
+
return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr);
|
|
80854
|
+
}
|
|
80855
|
+
return false;
|
|
80856
|
+
}
|
|
80796
80857
|
}
|
|
80797
80858
|
function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
|
|
80798
80859
|
var effectiveLeft = leftType;
|
|
@@ -81830,7 +81891,7 @@ var ts;
|
|
|
81830
81891
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81831
81892
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81832
81893
|
var indexSignatureMap_1 = new ts.Map();
|
|
81833
|
-
var
|
|
81894
|
+
var _loop_30 = function (declaration) {
|
|
81834
81895
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81835
81896
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81836
81897
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81845,7 +81906,7 @@ var ts;
|
|
|
81845
81906
|
};
|
|
81846
81907
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81847
81908
|
var declaration = _a[_i];
|
|
81848
|
-
|
|
81909
|
+
_loop_30(declaration);
|
|
81849
81910
|
}
|
|
81850
81911
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81851
81912
|
if (entry.declarations.length > 1) {
|
|
@@ -85445,7 +85506,7 @@ var ts;
|
|
|
85445
85506
|
var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
|
|
85446
85507
|
name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
|
|
85447
85508
|
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
85448
|
-
var
|
|
85509
|
+
var _loop_31 = function (info) {
|
|
85449
85510
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
85450
85511
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
85451
85512
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -85462,7 +85523,7 @@ var ts;
|
|
|
85462
85523
|
};
|
|
85463
85524
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
85464
85525
|
var info = indexInfos_9[_i];
|
|
85465
|
-
|
|
85526
|
+
_loop_31(info);
|
|
85466
85527
|
}
|
|
85467
85528
|
}
|
|
85468
85529
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -85470,7 +85531,7 @@ var ts;
|
|
|
85470
85531
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
85471
85532
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
|
|
85472
85533
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
85473
|
-
var
|
|
85534
|
+
var _loop_32 = function (info) {
|
|
85474
85535
|
if (info === checkInfo)
|
|
85475
85536
|
return "continue";
|
|
85476
85537
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -85485,7 +85546,7 @@ var ts;
|
|
|
85485
85546
|
};
|
|
85486
85547
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
85487
85548
|
var info = indexInfos_10[_i];
|
|
85488
|
-
|
|
85549
|
+
_loop_32(info);
|
|
85489
85550
|
}
|
|
85490
85551
|
}
|
|
85491
85552
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85805,7 +85866,7 @@ var ts;
|
|
|
85805
85866
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85806
85867
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85807
85868
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85808
|
-
var
|
|
85869
|
+
var _loop_33 = function (member) {
|
|
85809
85870
|
if (ts.hasAmbientModifier(member)) {
|
|
85810
85871
|
return "continue";
|
|
85811
85872
|
}
|
|
@@ -85822,7 +85883,7 @@ var ts;
|
|
|
85822
85883
|
};
|
|
85823
85884
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85824
85885
|
var member = _a[_i];
|
|
85825
|
-
|
|
85886
|
+
_loop_33(member);
|
|
85826
85887
|
}
|
|
85827
85888
|
}
|
|
85828
85889
|
/**
|
|
@@ -85910,7 +85971,7 @@ var ts;
|
|
|
85910
85971
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85911
85972
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
85912
85973
|
var issuedMemberError = false;
|
|
85913
|
-
var
|
|
85974
|
+
var _loop_34 = function (member) {
|
|
85914
85975
|
if (ts.isStatic(member)) {
|
|
85915
85976
|
return "continue";
|
|
85916
85977
|
}
|
|
@@ -85929,7 +85990,7 @@ var ts;
|
|
|
85929
85990
|
};
|
|
85930
85991
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85931
85992
|
var member = _a[_i];
|
|
85932
|
-
|
|
85993
|
+
_loop_34(member);
|
|
85933
85994
|
}
|
|
85934
85995
|
if (!issuedMemberError) {
|
|
85935
85996
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -86000,7 +86061,7 @@ var ts;
|
|
|
86000
86061
|
var _a, _b, _c, _d;
|
|
86001
86062
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
86002
86063
|
var baseProperties = getPropertiesOfType(baseType);
|
|
86003
|
-
var
|
|
86064
|
+
var _loop_35 = function (baseProperty) {
|
|
86004
86065
|
var base = getTargetSymbol(baseProperty);
|
|
86005
86066
|
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
|
|
86006
86067
|
return "continue";
|
|
@@ -86110,8 +86171,8 @@ var ts;
|
|
|
86110
86171
|
};
|
|
86111
86172
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
86112
86173
|
var baseProperty = baseProperties_1[_i];
|
|
86113
|
-
var
|
|
86114
|
-
switch (
|
|
86174
|
+
var state_11 = _loop_35(baseProperty);
|
|
86175
|
+
switch (state_11) {
|
|
86115
86176
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
86116
86177
|
}
|
|
86117
86178
|
}
|
|
@@ -115352,6 +115413,7 @@ var ts;
|
|
|
115352
115413
|
writeTrailingSemicolon();
|
|
115353
115414
|
}
|
|
115354
115415
|
function emitExportDeclaration(node) {
|
|
115416
|
+
emitModifiers(node, node.modifiers);
|
|
115355
115417
|
var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node);
|
|
115356
115418
|
writeSpace();
|
|
115357
115419
|
if (node.isTypeOnly) {
|
|
@@ -123835,17 +123897,13 @@ var ts;
|
|
|
123835
123897
|
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
123836
123898
|
return !!value && !!value.length;
|
|
123837
123899
|
}
|
|
123838
|
-
function createHasInvalidatedResolution(
|
|
123900
|
+
function createHasInvalidatedResolution(userProvidedHasInvalidatedResolution) {
|
|
123839
123901
|
// Ensure pending resolutions are applied
|
|
123840
123902
|
invalidateResolutionsOfFailedLookupLocations();
|
|
123841
|
-
if (forceAllFilesAsInvalidated) {
|
|
123842
|
-
// Any file asked would have invalidated resolution
|
|
123843
|
-
filesWithInvalidatedResolutions = undefined;
|
|
123844
|
-
return ts.returnTrue;
|
|
123845
|
-
}
|
|
123846
123903
|
var collected = filesWithInvalidatedResolutions;
|
|
123847
123904
|
filesWithInvalidatedResolutions = undefined;
|
|
123848
|
-
return function (path) { return (
|
|
123905
|
+
return function (path) { return (userProvidedHasInvalidatedResolution === null || userProvidedHasInvalidatedResolution === void 0 ? void 0 : userProvidedHasInvalidatedResolution(path)) ||
|
|
123906
|
+
!!(collected === null || collected === void 0 ? void 0 : collected.has(path)) ||
|
|
123849
123907
|
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
123850
123908
|
}
|
|
123851
123909
|
function startCachingPerDirectoryResolution() {
|
|
@@ -124954,7 +125012,7 @@ var ts;
|
|
|
124954
125012
|
});
|
|
124955
125013
|
// Sort by paths closest to importing file Name directory
|
|
124956
125014
|
var sortedPaths = [];
|
|
124957
|
-
var
|
|
125015
|
+
var _loop_36 = function (directory) {
|
|
124958
125016
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
124959
125017
|
var pathsInDirectory;
|
|
124960
125018
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -124978,9 +125036,9 @@ var ts;
|
|
|
124978
125036
|
};
|
|
124979
125037
|
var out_directory_1;
|
|
124980
125038
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
124981
|
-
var
|
|
125039
|
+
var state_12 = _loop_36(directory);
|
|
124982
125040
|
directory = out_directory_1;
|
|
124983
|
-
if (
|
|
125041
|
+
if (state_12 === "break")
|
|
124984
125042
|
break;
|
|
124985
125043
|
}
|
|
124986
125044
|
if (allFileNames.size) {
|
|
@@ -125049,7 +125107,7 @@ var ts;
|
|
|
125049
125107
|
}
|
|
125050
125108
|
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
125051
125109
|
for (var key in paths) {
|
|
125052
|
-
var
|
|
125110
|
+
var _loop_37 = function (patternText_1) {
|
|
125053
125111
|
var pattern = ts.normalizePath(patternText_1);
|
|
125054
125112
|
var indexOfStar = pattern.indexOf("*");
|
|
125055
125113
|
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
|
|
@@ -125116,9 +125174,9 @@ var ts;
|
|
|
125116
125174
|
};
|
|
125117
125175
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
125118
125176
|
var patternText_1 = _a[_i];
|
|
125119
|
-
var
|
|
125120
|
-
if (typeof
|
|
125121
|
-
return
|
|
125177
|
+
var state_13 = _loop_37(patternText_1);
|
|
125178
|
+
if (typeof state_13 === "object")
|
|
125179
|
+
return state_13.value;
|
|
125122
125180
|
}
|
|
125123
125181
|
}
|
|
125124
125182
|
function validateEnding(_a) {
|
|
@@ -126225,6 +126283,7 @@ var ts;
|
|
|
126225
126283
|
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
126226
126284
|
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
126227
126285
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
126286
|
+
var userProvidedHasInvalidatedResolution = ts.maybeBind(host, host.hasInvalidatedResolution) || ts.returnTrue;
|
|
126228
126287
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
126229
126288
|
synchronizeProgram();
|
|
126230
126289
|
// Update the wild card directory watch
|
|
@@ -126291,7 +126350,7 @@ var ts;
|
|
|
126291
126350
|
}
|
|
126292
126351
|
}
|
|
126293
126352
|
// All resolutions are invalid if user provided resolutions
|
|
126294
|
-
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
126353
|
+
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution ? userProvidedHasInvalidatedResolution : undefined);
|
|
126295
126354
|
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
126296
126355
|
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
126297
126356
|
if (hasChangedConfigFileParsingErrors) {
|
|
@@ -135457,7 +135516,7 @@ var ts;
|
|
|
135457
135516
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
135458
135517
|
}
|
|
135459
135518
|
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
135460
|
-
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,
|
|
135519
|
+
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;
|
|
135461
135520
|
// Verify if the file is JSX language variant
|
|
135462
135521
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) {
|
|
135463
135522
|
var completionInfo = getJsxClosingTagCompletion(location, sourceFile);
|
|
@@ -135471,7 +135530,7 @@ var ts;
|
|
|
135471
135530
|
return undefined;
|
|
135472
135531
|
}
|
|
135473
135532
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
135474
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer,
|
|
135533
|
+
/*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);
|
|
135475
135534
|
if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) {
|
|
135476
135535
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
135477
135536
|
var keywordEntry = _a[_i];
|
|
@@ -135589,7 +135648,7 @@ var ts;
|
|
|
135589
135648
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
135590
135649
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority };
|
|
135591
135650
|
}
|
|
135592
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
135651
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
135593
135652
|
var _a, _b;
|
|
135594
135653
|
var insertText;
|
|
135595
135654
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
@@ -135645,8 +135704,8 @@ var ts;
|
|
|
135645
135704
|
}
|
|
135646
135705
|
if (originIsResolvedExport(origin)) {
|
|
135647
135706
|
sourceDisplay = [ts.textPart(origin.moduleSpecifier)];
|
|
135648
|
-
if (
|
|
135649
|
-
(_a = getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
135707
|
+
if (importStatementCompletion) {
|
|
135708
|
+
(_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
|
|
135650
135709
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
135651
135710
|
}
|
|
135652
135711
|
}
|
|
@@ -135701,7 +135760,7 @@ var ts;
|
|
|
135701
135760
|
}
|
|
135702
135761
|
if (originIsExport(origin) || originIsResolvedExport(origin)) {
|
|
135703
135762
|
data = originToCompletionEntryData(origin);
|
|
135704
|
-
hasAction = !
|
|
135763
|
+
hasAction = !importStatementCompletion;
|
|
135705
135764
|
}
|
|
135706
135765
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
135707
135766
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
@@ -135724,7 +135783,7 @@ var ts;
|
|
|
135724
135783
|
labelDetails: labelDetails,
|
|
135725
135784
|
isSnippet: isSnippet,
|
|
135726
135785
|
isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
|
|
135727
|
-
isImportStatementCompletion: !!
|
|
135786
|
+
isImportStatementCompletion: !!importStatementCompletion || undefined,
|
|
135728
135787
|
data: data,
|
|
135729
135788
|
};
|
|
135730
135789
|
}
|
|
@@ -136096,19 +136155,16 @@ var ts;
|
|
|
136096
136155
|
};
|
|
136097
136156
|
return unresolvedOrigin;
|
|
136098
136157
|
}
|
|
136099
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
136100
|
-
var
|
|
136101
|
-
var sourceFile = importCompletionNode.getSourceFile();
|
|
136102
|
-
var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile);
|
|
136158
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
136159
|
+
var replacementSpan = importStatementCompletion.replacementSpan;
|
|
136103
136160
|
var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
136104
136161
|
var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ :
|
|
136105
136162
|
origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ :
|
|
136106
136163
|
0 /* ExportKind.Named */;
|
|
136107
136164
|
var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
136108
136165
|
var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true);
|
|
136109
|
-
var
|
|
136110
|
-
var
|
|
136111
|
-
var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
136166
|
+
var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier;
|
|
136167
|
+
var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
136112
136168
|
var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : "";
|
|
136113
136169
|
var suffix = useSemicolons ? ";" : "";
|
|
136114
136170
|
switch (importKind) {
|
|
@@ -136142,7 +136198,7 @@ var ts;
|
|
|
136142
136198
|
return CompletionSource.TypeOnlyAlias;
|
|
136143
136199
|
}
|
|
136144
136200
|
}
|
|
136145
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer,
|
|
136201
|
+
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) {
|
|
136146
136202
|
var _a;
|
|
136147
136203
|
var start = ts.timestamp();
|
|
136148
136204
|
var variableDeclaration = getVariableDeclaration(location);
|
|
@@ -136163,7 +136219,7 @@ var ts;
|
|
|
136163
136219
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
136164
136220
|
var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority;
|
|
136165
136221
|
var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText);
|
|
136166
|
-
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
136222
|
+
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);
|
|
136167
136223
|
if (!entry) {
|
|
136168
136224
|
continue;
|
|
136169
136225
|
}
|
|
@@ -136354,7 +136410,7 @@ var ts;
|
|
|
136354
136410
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
136355
136411
|
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
|
|
136356
136412
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
136357
|
-
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).
|
|
136413
|
+
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
|
|
136358
136414
|
// Import statement completion: 'import c|'
|
|
136359
136415
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
136360
136416
|
}
|
|
@@ -136555,34 +136611,34 @@ var ts;
|
|
|
136555
136611
|
var isStartingCloseTag = false;
|
|
136556
136612
|
var isJsxInitializer = false;
|
|
136557
136613
|
var isJsxIdentifierExpected = false;
|
|
136558
|
-
var
|
|
136614
|
+
var importStatementCompletion;
|
|
136559
136615
|
var location = ts.getTouchingPropertyName(sourceFile, position);
|
|
136560
136616
|
var keywordFilters = 0 /* KeywordCompletionFilters.None */;
|
|
136561
136617
|
var isNewIdentifierLocation = false;
|
|
136562
136618
|
var flags = 0 /* CompletionInfoFlags.None */;
|
|
136563
136619
|
if (contextToken) {
|
|
136564
|
-
var
|
|
136565
|
-
|
|
136566
|
-
|
|
136567
|
-
if (importStatementCompletion.isKeywordOnlyCompletion) {
|
|
136620
|
+
var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
|
|
136621
|
+
if (importStatementCompletionInfo.keywordCompletion) {
|
|
136622
|
+
if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
|
|
136568
136623
|
return {
|
|
136569
136624
|
kind: 4 /* CompletionDataKind.Keywords */,
|
|
136570
|
-
keywordCompletions: [keywordToCompletionEntry(
|
|
136571
|
-
isNewIdentifierLocation: isNewIdentifierLocation,
|
|
136625
|
+
keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)],
|
|
136626
|
+
isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation,
|
|
136572
136627
|
};
|
|
136573
136628
|
}
|
|
136574
|
-
keywordFilters = keywordFiltersFromSyntaxKind(
|
|
136629
|
+
keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion);
|
|
136575
136630
|
}
|
|
136576
|
-
if (
|
|
136631
|
+
if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
|
|
136577
136632
|
// Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
|
|
136578
136633
|
// added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
|
|
136579
136634
|
// is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
|
|
136580
136635
|
// to opt in with the `includeCompletionsForImportStatements` user preference.
|
|
136581
|
-
importCompletionNode = importStatementCompletion.replacementNode;
|
|
136582
136636
|
flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */;
|
|
136637
|
+
importStatementCompletion = importStatementCompletionInfo;
|
|
136638
|
+
isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
|
|
136583
136639
|
}
|
|
136584
136640
|
// Bail out if this is a known invalid completion location
|
|
136585
|
-
if (!
|
|
136641
|
+
if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
|
|
136586
136642
|
log("Returning an empty list because completion was requested in an invalid position.");
|
|
136587
136643
|
return keywordFilters
|
|
136588
136644
|
? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation())
|
|
@@ -136628,7 +136684,7 @@ var ts;
|
|
|
136628
136684
|
return undefined;
|
|
136629
136685
|
}
|
|
136630
136686
|
}
|
|
136631
|
-
else if (!
|
|
136687
|
+
else if (!importStatementCompletion) {
|
|
136632
136688
|
// <UI.Test /* completion position */ />
|
|
136633
136689
|
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
|
|
136634
136690
|
// Then, try to get a JSX container and its associated attributes type.
|
|
@@ -136771,7 +136827,7 @@ var ts;
|
|
|
136771
136827
|
isTypeOnlyLocation: isTypeOnlyLocation,
|
|
136772
136828
|
isJsxIdentifierExpected: isJsxIdentifierExpected,
|
|
136773
136829
|
isRightOfOpenTag: isRightOfOpenTag,
|
|
136774
|
-
|
|
136830
|
+
importStatementCompletion: importStatementCompletion,
|
|
136775
136831
|
hasUnresolvedAutoImports: hasUnresolvedAutoImports,
|
|
136776
136832
|
flags: flags,
|
|
136777
136833
|
};
|
|
@@ -137025,7 +137081,7 @@ var ts;
|
|
|
137025
137081
|
return 1 /* GlobalsSearch.Success */;
|
|
137026
137082
|
}
|
|
137027
137083
|
function tryGetImportCompletionSymbols() {
|
|
137028
|
-
if (!
|
|
137084
|
+
if (!importStatementCompletion)
|
|
137029
137085
|
return 0 /* GlobalsSearch.Continue */;
|
|
137030
137086
|
isNewIdentifierLocation = true;
|
|
137031
137087
|
collectAutoImports();
|
|
@@ -137108,7 +137164,7 @@ var ts;
|
|
|
137108
137164
|
}
|
|
137109
137165
|
function shouldOfferImportCompletions() {
|
|
137110
137166
|
// If already typing an import statement, provide completions for it.
|
|
137111
|
-
if (
|
|
137167
|
+
if (importStatementCompletion)
|
|
137112
137168
|
return true;
|
|
137113
137169
|
// If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
|
|
137114
137170
|
if (isNonContextualObjectLiteral)
|
|
@@ -137138,7 +137194,7 @@ var ts;
|
|
|
137138
137194
|
}
|
|
137139
137195
|
function isTypeOnlyCompletion() {
|
|
137140
137196
|
return insideJsDocTagTypeExpression
|
|
137141
|
-
|| !!
|
|
137197
|
+
|| !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
|
|
137142
137198
|
|| !isContextTokenValueLocation(contextToken) &&
|
|
137143
137199
|
(ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
|
|
137144
137200
|
|| ts.isPartOfTypeNode(location)
|
|
@@ -137188,8 +137244,7 @@ var ts;
|
|
|
137188
137244
|
flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */;
|
|
137189
137245
|
// import { type | -> token text should be blank
|
|
137190
137246
|
var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
|
|
137191
|
-
&&
|
|
137192
|
-
&& couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
|
|
137247
|
+
&& importStatementCompletion;
|
|
137193
137248
|
var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" :
|
|
137194
137249
|
previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() :
|
|
137195
137250
|
"";
|
|
@@ -137197,14 +137252,14 @@ var ts;
|
|
|
137197
137252
|
var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken);
|
|
137198
137253
|
var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
137199
137254
|
var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
137200
|
-
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!
|
|
137255
|
+
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
137201
137256
|
exportInfo.search(sourceFile.path,
|
|
137202
137257
|
/*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
|
|
137203
137258
|
if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
|
|
137204
137259
|
return false;
|
|
137205
137260
|
if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
|
|
137206
137261
|
return false;
|
|
137207
|
-
if (!isTypeOnlyLocation && !
|
|
137262
|
+
if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */))
|
|
137208
137263
|
return false;
|
|
137209
137264
|
if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */)))
|
|
137210
137265
|
return false;
|
|
@@ -137285,7 +137340,7 @@ var ts;
|
|
|
137285
137340
|
return;
|
|
137286
137341
|
}
|
|
137287
137342
|
symbolToOriginInfoMap[symbols.length] = origin;
|
|
137288
|
-
symbolToSortTextMap[symbolId] =
|
|
137343
|
+
symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
|
|
137289
137344
|
symbols.push(symbol);
|
|
137290
137345
|
}
|
|
137291
137346
|
/* Mutates `symbols` and `symbolToOriginInfoMap`. */
|
|
@@ -138552,6 +138607,7 @@ var ts;
|
|
|
138552
138607
|
return undefined;
|
|
138553
138608
|
}
|
|
138554
138609
|
function getImportStatementCompletionInfo(contextToken) {
|
|
138610
|
+
var _a, _b, _c;
|
|
138555
138611
|
var keywordCompletion;
|
|
138556
138612
|
var isKeywordOnlyCompletion = false;
|
|
138557
138613
|
var candidate = getCandidate();
|
|
@@ -138559,9 +138615,9 @@ var ts;
|
|
|
138559
138615
|
isKeywordOnlyCompletion: isKeywordOnlyCompletion,
|
|
138560
138616
|
keywordCompletion: keywordCompletion,
|
|
138561
138617
|
isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */),
|
|
138562
|
-
|
|
138563
|
-
|
|
138564
|
-
|
|
138618
|
+
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),
|
|
138619
|
+
couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken),
|
|
138620
|
+
replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate),
|
|
138565
138621
|
};
|
|
138566
138622
|
function getCandidate() {
|
|
138567
138623
|
var parent = contextToken.parent;
|
|
@@ -138603,14 +138659,71 @@ var ts;
|
|
|
138603
138659
|
return undefined;
|
|
138604
138660
|
}
|
|
138605
138661
|
}
|
|
138662
|
+
function getSingleLineReplacementSpanForImportCompletionNode(node) {
|
|
138663
|
+
var _a, _b, _c;
|
|
138664
|
+
if (!node)
|
|
138665
|
+
return undefined;
|
|
138666
|
+
var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node;
|
|
138667
|
+
var sourceFile = top.getSourceFile();
|
|
138668
|
+
if (ts.rangeIsOnSingleLine(top, sourceFile)) {
|
|
138669
|
+
return ts.createTextSpanFromNode(top, sourceFile);
|
|
138670
|
+
}
|
|
138671
|
+
// ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration
|
|
138672
|
+
ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */);
|
|
138673
|
+
// Guess which point in the import might actually be a later statement parsed as part of the import
|
|
138674
|
+
// during parser recovery - either in the middle of named imports, or the module specifier.
|
|
138675
|
+
var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */
|
|
138676
|
+
? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier
|
|
138677
|
+
: top.moduleReference;
|
|
138678
|
+
var withoutModuleSpecifier = {
|
|
138679
|
+
pos: top.getFirstToken().getStart(),
|
|
138680
|
+
end: potentialSplitPoint.pos,
|
|
138681
|
+
};
|
|
138682
|
+
// The module specifier/reference was previously found to be missing, empty, or
|
|
138683
|
+
// not a string literal - in this last case, it's likely that statement on a following
|
|
138684
|
+
// line was parsed as the module specifier of a partially-typed import, e.g.
|
|
138685
|
+
// import Foo|
|
|
138686
|
+
// interface Blah {}
|
|
138687
|
+
// This appears to be a multiline-import, and editors can't replace multiple lines.
|
|
138688
|
+
// But if everything but the "module specifier" is on one line, by this point we can
|
|
138689
|
+
// assume that the "module specifier" is actually just another statement, and return
|
|
138690
|
+
// the single-line range of the import excluding that probable statement.
|
|
138691
|
+
if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) {
|
|
138692
|
+
return ts.createTextSpanFromRange(withoutModuleSpecifier);
|
|
138693
|
+
}
|
|
138694
|
+
}
|
|
138695
|
+
// Tries to identify the first named import that is not really a named import, but rather
|
|
138696
|
+
// just parser recovery for a situation like:
|
|
138697
|
+
// import { Foo|
|
|
138698
|
+
// interface Bar {}
|
|
138699
|
+
// in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller
|
|
138700
|
+
// will also check if this token is on a separate line from the rest of the import.
|
|
138701
|
+
function getPotentiallyInvalidImportSpecifier(namedBindings) {
|
|
138702
|
+
var _a;
|
|
138703
|
+
return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) {
|
|
138704
|
+
var _a;
|
|
138705
|
+
return !e.propertyName &&
|
|
138706
|
+
ts.isStringANonContextualKeyword(e.name.text) &&
|
|
138707
|
+
((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */;
|
|
138708
|
+
});
|
|
138709
|
+
}
|
|
138606
138710
|
function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) {
|
|
138607
138711
|
return ts.isImportSpecifier(importSpecifier)
|
|
138608
138712
|
&& (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken));
|
|
138609
138713
|
}
|
|
138610
138714
|
function canCompleteFromNamedBindings(namedBindings) {
|
|
138611
|
-
|
|
138612
|
-
|
|
138613
|
-
|
|
138715
|
+
if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) {
|
|
138716
|
+
return false;
|
|
138717
|
+
}
|
|
138718
|
+
if (ts.isNamedImports(namedBindings)) {
|
|
138719
|
+
// We can only complete on named imports if there are no other named imports already,
|
|
138720
|
+
// but parser recovery sometimes puts later statements in the named imports list, so
|
|
138721
|
+
// we try to only consider the probably-valid ones.
|
|
138722
|
+
var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings);
|
|
138723
|
+
var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length;
|
|
138724
|
+
return validImports < 2;
|
|
138725
|
+
}
|
|
138726
|
+
return true;
|
|
138614
138727
|
}
|
|
138615
138728
|
function isModuleSpecifierMissingOrEmpty(specifier) {
|
|
138616
138729
|
var _a;
|
|
@@ -146645,6 +146758,10 @@ var ts;
|
|
|
146645
146758
|
pushSelectionCommentRange(comment.pos, comment.end);
|
|
146646
146759
|
}
|
|
146647
146760
|
if (positionShouldSnapToNode(sourceFile, pos, node)) {
|
|
146761
|
+
if (ts.isFunctionBody(node)
|
|
146762
|
+
&& ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) {
|
|
146763
|
+
pushSelectionRange(node.getStart(sourceFile), node.getEnd());
|
|
146764
|
+
}
|
|
146648
146765
|
// 1. Blocks are effectively redundant with SyntaxLists.
|
|
146649
146766
|
// 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
|
|
146650
146767
|
// of things that should be considered independently.
|
|
@@ -157343,7 +157460,7 @@ var ts;
|
|
|
157343
157460
|
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
|
|
157344
157461
|
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
157345
157462
|
return;
|
|
157346
|
-
var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157463
|
+
var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157347
157464
|
if (declaration === undefined)
|
|
157348
157465
|
return;
|
|
157349
157466
|
if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) {
|
|
@@ -157377,14 +157494,6 @@ var ts;
|
|
|
157377
157494
|
}
|
|
157378
157495
|
}
|
|
157379
157496
|
}
|
|
157380
|
-
function findAncestorMatchingSpan(sourceFile, span) {
|
|
157381
|
-
var end = ts.textSpanEnd(span);
|
|
157382
|
-
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
157383
|
-
while (token.end < end) {
|
|
157384
|
-
token = token.parent;
|
|
157385
|
-
}
|
|
157386
|
-
return token;
|
|
157387
|
-
}
|
|
157388
157497
|
function tryGetConstraintFromDiagnosticMessage(messageText) {
|
|
157389
157498
|
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1];
|
|
157390
157499
|
return constraint;
|
|
@@ -158265,7 +158374,7 @@ var ts;
|
|
|
158265
158374
|
return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
158266
158375
|
}
|
|
158267
158376
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
158268
|
-
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
158377
|
+
if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
158269
158378
|
return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
|
|
158270
158379
|
}
|
|
158271
158380
|
return undefined;
|
|
@@ -158930,6 +159039,63 @@ var ts;
|
|
|
158930
159039
|
})(ts || (ts = {}));
|
|
158931
159040
|
/* @internal */
|
|
158932
159041
|
var ts;
|
|
159042
|
+
(function (ts) {
|
|
159043
|
+
var codefix;
|
|
159044
|
+
(function (codefix) {
|
|
159045
|
+
var fixId = "fixNaNEquality";
|
|
159046
|
+
var errorCodes = [
|
|
159047
|
+
ts.Diagnostics.This_condition_will_always_return_0.code,
|
|
159048
|
+
];
|
|
159049
|
+
codefix.registerCodeFix({
|
|
159050
|
+
errorCodes: errorCodes,
|
|
159051
|
+
getCodeActions: function (context) {
|
|
159052
|
+
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
159053
|
+
var info = getInfo(program, sourceFile, span);
|
|
159054
|
+
if (info === undefined)
|
|
159055
|
+
return;
|
|
159056
|
+
var suggestion = info.suggestion, expression = info.expression, arg = info.arg;
|
|
159057
|
+
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); });
|
|
159058
|
+
return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
159059
|
+
},
|
|
159060
|
+
fixIds: [fixId],
|
|
159061
|
+
getAllCodeActions: function (context) {
|
|
159062
|
+
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
159063
|
+
var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length));
|
|
159064
|
+
if (info) {
|
|
159065
|
+
doChange(changes, diag.file, info.arg, info.expression);
|
|
159066
|
+
}
|
|
159067
|
+
});
|
|
159068
|
+
}
|
|
159069
|
+
});
|
|
159070
|
+
function getInfo(program, sourceFile, span) {
|
|
159071
|
+
var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
|
|
159072
|
+
if (diag === undefined || diag.relatedInformation === undefined)
|
|
159073
|
+
return;
|
|
159074
|
+
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; });
|
|
159075
|
+
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
159076
|
+
return;
|
|
159077
|
+
var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
159078
|
+
if (token === undefined)
|
|
159079
|
+
return;
|
|
159080
|
+
if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) {
|
|
159081
|
+
return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token };
|
|
159082
|
+
}
|
|
159083
|
+
return undefined;
|
|
159084
|
+
}
|
|
159085
|
+
function doChange(changes, sourceFile, arg, expression) {
|
|
159086
|
+
var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]);
|
|
159087
|
+
var operator = expression.operatorToken.kind;
|
|
159088
|
+
changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */
|
|
159089
|
+
? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression);
|
|
159090
|
+
}
|
|
159091
|
+
function getSuggestion(messageText) {
|
|
159092
|
+
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1];
|
|
159093
|
+
return suggestion;
|
|
159094
|
+
}
|
|
159095
|
+
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
159096
|
+
})(ts || (ts = {}));
|
|
159097
|
+
/* @internal */
|
|
159098
|
+
var ts;
|
|
158933
159099
|
(function (ts) {
|
|
158934
159100
|
var codefix;
|
|
158935
159101
|
(function (codefix) {
|
|
@@ -161647,6 +161813,15 @@ var ts;
|
|
|
161647
161813
|
symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); });
|
|
161648
161814
|
}
|
|
161649
161815
|
codefix.importSymbols = importSymbols;
|
|
161816
|
+
function findAncestorMatchingSpan(sourceFile, span) {
|
|
161817
|
+
var end = ts.textSpanEnd(span);
|
|
161818
|
+
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
161819
|
+
while (token.end < end) {
|
|
161820
|
+
token = token.parent;
|
|
161821
|
+
}
|
|
161822
|
+
return token;
|
|
161823
|
+
}
|
|
161824
|
+
codefix.findAncestorMatchingSpan = findAncestorMatchingSpan;
|
|
161650
161825
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
161651
161826
|
})(ts || (ts = {}));
|
|
161652
161827
|
/* @internal */
|