typescript 4.9.0-dev.20220920 → 4.9.0-dev.20220922
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 +168 -87
- package/lib/tsserver.js +347 -145
- package/lib/tsserverlibrary.js +347 -145
- package/lib/typescript.js +347 -145
- package/lib/typescriptServices.js +347 -145
- package/lib/typingsInstaller.js +177 -91
- 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-dev.
|
|
111
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.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?"),
|
|
@@ -11896,12 +11899,36 @@ var ts;
|
|
|
11896
11899
|
pos++;
|
|
11897
11900
|
return token = 0 /* SyntaxKind.Unknown */;
|
|
11898
11901
|
}
|
|
11899
|
-
|
|
11902
|
+
var charAfterHash = codePointAt(text, pos + 1);
|
|
11903
|
+
if (charAfterHash === 92 /* CharacterCodes.backslash */) {
|
|
11900
11904
|
pos++;
|
|
11901
|
-
|
|
11905
|
+
var extendedCookedChar_1 = peekExtendedUnicodeEscape();
|
|
11906
|
+
if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) {
|
|
11907
|
+
pos += 3;
|
|
11908
|
+
tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */;
|
|
11909
|
+
tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
|
|
11910
|
+
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
11911
|
+
}
|
|
11912
|
+
var cookedChar_1 = peekUnicodeEscape();
|
|
11913
|
+
if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) {
|
|
11914
|
+
pos += 6;
|
|
11915
|
+
tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */;
|
|
11916
|
+
tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts();
|
|
11917
|
+
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
11918
|
+
}
|
|
11919
|
+
pos--;
|
|
11920
|
+
}
|
|
11921
|
+
if (isIdentifierStart(charAfterHash, languageVersion)) {
|
|
11922
|
+
pos++;
|
|
11923
|
+
// We're relying on scanIdentifier's behavior and adjusting the token kind after the fact.
|
|
11924
|
+
// Notably absent from this block is the fact that calling a function named "scanIdentifier",
|
|
11925
|
+
// but identifiers don't include '#', and that function doesn't deal with it at all.
|
|
11926
|
+
// This works because 'scanIdentifier' tries to reuse source characters and builds up substrings;
|
|
11927
|
+
// however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us.
|
|
11928
|
+
scanIdentifier(charAfterHash, languageVersion);
|
|
11902
11929
|
}
|
|
11903
11930
|
else {
|
|
11904
|
-
tokenValue =
|
|
11931
|
+
tokenValue = "#";
|
|
11905
11932
|
error(ts.Diagnostics.Invalid_character, pos++, charSize(ch));
|
|
11906
11933
|
}
|
|
11907
11934
|
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
@@ -33139,7 +33166,7 @@ var ts;
|
|
|
33139
33166
|
}
|
|
33140
33167
|
function parsePrivateIdentifier() {
|
|
33141
33168
|
var pos = getNodePos();
|
|
33142
|
-
var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.
|
|
33169
|
+
var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue()));
|
|
33143
33170
|
nextToken();
|
|
33144
33171
|
return finishNode(node, pos);
|
|
33145
33172
|
}
|
|
@@ -45225,6 +45252,7 @@ var ts;
|
|
|
45225
45252
|
}
|
|
45226
45253
|
}
|
|
45227
45254
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
45255
|
+
var _a;
|
|
45228
45256
|
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
|
|
45229
45257
|
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
|
|
45230
45258
|
var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
@@ -45239,13 +45267,7 @@ var ts;
|
|
|
45239
45267
|
return withPackageId(packageInfo, fromDirectory);
|
|
45240
45268
|
}
|
|
45241
45269
|
}
|
|
45242
|
-
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
45243
45270
|
var loader = function (extensions, candidate, onlyRecordFailures, state) {
|
|
45244
|
-
var _a;
|
|
45245
|
-
// package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
|
|
45246
|
-
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
45247
|
-
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
45248
|
-
}
|
|
45249
45271
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
45250
45272
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths);
|
|
45251
45273
|
if (!pathAndExtension && packageInfo
|
|
@@ -45258,19 +45280,24 @@ var ts;
|
|
|
45258
45280
|
}
|
|
45259
45281
|
return withPackageId(packageInfo, pathAndExtension);
|
|
45260
45282
|
};
|
|
45261
|
-
|
|
45262
|
-
|
|
45263
|
-
|
|
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.
|
|
45264
45287
|
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
45265
|
-
|
|
45266
|
-
|
|
45267
|
-
|
|
45268
|
-
|
|
45269
|
-
|
|
45270
|
-
|
|
45271
|
-
|
|
45272
|
-
|
|
45273
|
-
|
|
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;
|
|
45274
45301
|
}
|
|
45275
45302
|
}
|
|
45276
45303
|
return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
@@ -49772,6 +49799,7 @@ var ts;
|
|
|
49772
49799
|
var deferredGlobalOmitSymbol;
|
|
49773
49800
|
var deferredGlobalAwaitedSymbol;
|
|
49774
49801
|
var deferredGlobalBigIntType;
|
|
49802
|
+
var deferredGlobalNaNSymbol;
|
|
49775
49803
|
var deferredGlobalRecordSymbol;
|
|
49776
49804
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49777
49805
|
var flowLoopStart = 0;
|
|
@@ -55450,6 +55478,7 @@ var ts;
|
|
|
55450
55478
|
&& symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */
|
|
55451
55479
|
&& !(symbol.flags & 4194304 /* SymbolFlags.Prototype */)
|
|
55452
55480
|
&& !(symbol.flags & 32 /* SymbolFlags.Class */)
|
|
55481
|
+
&& !(symbol.flags & 8192 /* SymbolFlags.Method */)
|
|
55453
55482
|
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
55454
55483
|
if (propertyAsAlias) {
|
|
55455
55484
|
var createdExport = serializeMaybeAliasAssignment(symbol);
|
|
@@ -60260,7 +60289,7 @@ var ts;
|
|
|
60260
60289
|
var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
|
|
60261
60290
|
// If the symbols are instances of one another with identical types - consider the symbols
|
|
60262
60291
|
// equivalent and just use the first one, which thus allows us to avoid eliding private
|
|
60263
|
-
// 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
|
|
60264
60293
|
if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
|
|
60265
60294
|
// If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
|
|
60266
60295
|
// to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
|
|
@@ -60308,7 +60337,11 @@ var ts;
|
|
|
60308
60337
|
}
|
|
60309
60338
|
}
|
|
60310
60339
|
}
|
|
60311
|
-
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())))) {
|
|
60312
60345
|
// No property was found, or, in a union, a property has a private or protected declaration in one
|
|
60313
60346
|
// constituent, but is missing or has a different declaration in another constituent.
|
|
60314
60347
|
return undefined;
|
|
@@ -60410,6 +60443,33 @@ var ts;
|
|
|
60410
60443
|
}
|
|
60411
60444
|
return property;
|
|
60412
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
|
+
}
|
|
60413
60473
|
function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
|
|
60414
60474
|
var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
60415
60475
|
// We need to filter out partial properties in union types
|
|
@@ -61124,7 +61184,7 @@ var ts;
|
|
|
61124
61184
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
61125
61185
|
if (indexSymbol.declarations) {
|
|
61126
61186
|
var indexInfos_4 = [];
|
|
61127
|
-
var
|
|
61187
|
+
var _loop_15 = function (declaration) {
|
|
61128
61188
|
if (declaration.parameters.length === 1) {
|
|
61129
61189
|
var parameter = declaration.parameters[0];
|
|
61130
61190
|
if (parameter.type) {
|
|
@@ -61138,7 +61198,7 @@ var ts;
|
|
|
61138
61198
|
};
|
|
61139
61199
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
61140
61200
|
var declaration = _a[_i];
|
|
61141
|
-
|
|
61201
|
+
_loop_15(declaration);
|
|
61142
61202
|
}
|
|
61143
61203
|
return indexInfos_4;
|
|
61144
61204
|
}
|
|
@@ -61155,7 +61215,7 @@ var ts;
|
|
|
61155
61215
|
var _a;
|
|
61156
61216
|
var inferences;
|
|
61157
61217
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
61158
|
-
var
|
|
61218
|
+
var _loop_16 = function (declaration) {
|
|
61159
61219
|
if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
|
|
61160
61220
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
61161
61221
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -61219,7 +61279,7 @@ var ts;
|
|
|
61219
61279
|
};
|
|
61220
61280
|
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
61221
61281
|
var declaration = _b[_i];
|
|
61222
|
-
|
|
61282
|
+
_loop_16(declaration);
|
|
61223
61283
|
}
|
|
61224
61284
|
}
|
|
61225
61285
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61876,6 +61936,9 @@ var ts;
|
|
|
61876
61936
|
function getGlobalBigIntType() {
|
|
61877
61937
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61878
61938
|
}
|
|
61939
|
+
function getGlobalNaNSymbol() {
|
|
61940
|
+
return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
|
|
61941
|
+
}
|
|
61879
61942
|
function getGlobalRecordSymbol() {
|
|
61880
61943
|
deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61881
61944
|
return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
|
|
@@ -62116,7 +62179,7 @@ var ts;
|
|
|
62116
62179
|
var lastRequiredIndex = -1;
|
|
62117
62180
|
var firstRestIndex = -1;
|
|
62118
62181
|
var lastOptionalOrRestIndex = -1;
|
|
62119
|
-
var
|
|
62182
|
+
var _loop_17 = function (i) {
|
|
62120
62183
|
var type = elementTypes[i];
|
|
62121
62184
|
var flags = target.elementFlags[i];
|
|
62122
62185
|
if (flags & 8 /* ElementFlags.Variadic */) {
|
|
@@ -62146,9 +62209,9 @@ var ts;
|
|
|
62146
62209
|
}
|
|
62147
62210
|
};
|
|
62148
62211
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
62149
|
-
var
|
|
62150
|
-
if (typeof
|
|
62151
|
-
return
|
|
62212
|
+
var state_5 = _loop_17(i);
|
|
62213
|
+
if (typeof state_5 === "object")
|
|
62214
|
+
return state_5.value;
|
|
62152
62215
|
}
|
|
62153
62216
|
// Turn optional elements preceding the last required element into required elements
|
|
62154
62217
|
for (var i = 0; i < lastRequiredIndex; i++) {
|
|
@@ -62176,7 +62239,7 @@ var ts;
|
|
|
62176
62239
|
if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
|
|
62177
62240
|
lastOptionalOrRestIndex = expandedFlags.length;
|
|
62178
62241
|
}
|
|
62179
|
-
expandedTypes.push(type);
|
|
62242
|
+
expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
|
|
62180
62243
|
expandedFlags.push(flags);
|
|
62181
62244
|
if (expandedDeclarations && declaration) {
|
|
62182
62245
|
expandedDeclarations.push(declaration);
|
|
@@ -62342,7 +62405,7 @@ var ts;
|
|
|
62342
62405
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
62343
62406
|
if (templates.length) {
|
|
62344
62407
|
var i = types.length;
|
|
62345
|
-
var
|
|
62408
|
+
var _loop_18 = function () {
|
|
62346
62409
|
i--;
|
|
62347
62410
|
var t = types[i];
|
|
62348
62411
|
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -62350,7 +62413,7 @@ var ts;
|
|
|
62350
62413
|
}
|
|
62351
62414
|
};
|
|
62352
62415
|
while (i > 0) {
|
|
62353
|
-
|
|
62416
|
+
_loop_18();
|
|
62354
62417
|
}
|
|
62355
62418
|
}
|
|
62356
62419
|
}
|
|
@@ -62427,14 +62490,14 @@ var ts;
|
|
|
62427
62490
|
var namedUnions = [];
|
|
62428
62491
|
addNamedUnions(namedUnions, types);
|
|
62429
62492
|
var reducedTypes = [];
|
|
62430
|
-
var
|
|
62493
|
+
var _loop_19 = function (t) {
|
|
62431
62494
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
62432
62495
|
reducedTypes.push(t);
|
|
62433
62496
|
}
|
|
62434
62497
|
};
|
|
62435
62498
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
62436
62499
|
var t = typeSet_1[_i];
|
|
62437
|
-
|
|
62500
|
+
_loop_19(t);
|
|
62438
62501
|
}
|
|
62439
62502
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
62440
62503
|
return namedUnions[0];
|
|
@@ -63664,7 +63727,7 @@ var ts;
|
|
|
63664
63727
|
var result;
|
|
63665
63728
|
var extraTypes;
|
|
63666
63729
|
var tailCount = 0;
|
|
63667
|
-
var
|
|
63730
|
+
var _loop_20 = function () {
|
|
63668
63731
|
if (tailCount === 1000) {
|
|
63669
63732
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63670
63733
|
result = errorType;
|
|
@@ -63785,10 +63848,10 @@ var ts;
|
|
|
63785
63848
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63786
63849
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63787
63850
|
while (true) {
|
|
63788
|
-
var
|
|
63789
|
-
if (typeof
|
|
63790
|
-
return
|
|
63791
|
-
if (
|
|
63851
|
+
var state_6 = _loop_20();
|
|
63852
|
+
if (typeof state_6 === "object")
|
|
63853
|
+
return state_6.value;
|
|
63854
|
+
if (state_6 === "break")
|
|
63792
63855
|
break;
|
|
63793
63856
|
}
|
|
63794
63857
|
return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
|
|
@@ -66403,7 +66466,7 @@ var ts;
|
|
|
66403
66466
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
66404
66467
|
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
|
|
66405
66468
|
}
|
|
66406
|
-
var
|
|
66469
|
+
var _loop_21 = function (prop) {
|
|
66407
66470
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
66408
66471
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
66409
66472
|
if (reportErrors) {
|
|
@@ -66466,9 +66529,9 @@ var ts;
|
|
|
66466
66529
|
};
|
|
66467
66530
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
66468
66531
|
var prop = _b[_i];
|
|
66469
|
-
var
|
|
66470
|
-
if (typeof
|
|
66471
|
-
return
|
|
66532
|
+
var state_7 = _loop_21(prop);
|
|
66533
|
+
if (typeof state_7 === "object")
|
|
66534
|
+
return state_7.value;
|
|
66472
66535
|
}
|
|
66473
66536
|
return false;
|
|
66474
66537
|
}
|
|
@@ -67459,11 +67522,11 @@ var ts;
|
|
|
67459
67522
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
67460
67523
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
67461
67524
|
var matchingTypes = [];
|
|
67462
|
-
var
|
|
67525
|
+
var _loop_22 = function (combination) {
|
|
67463
67526
|
var hasMatch = false;
|
|
67464
67527
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
67465
67528
|
var type = _d[_c];
|
|
67466
|
-
var
|
|
67529
|
+
var _loop_23 = function (i) {
|
|
67467
67530
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
67468
67531
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
67469
67532
|
if (!targetProperty)
|
|
@@ -67479,8 +67542,8 @@ var ts;
|
|
|
67479
67542
|
}
|
|
67480
67543
|
};
|
|
67481
67544
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
67482
|
-
var
|
|
67483
|
-
switch (
|
|
67545
|
+
var state_9 = _loop_23(i);
|
|
67546
|
+
switch (state_9) {
|
|
67484
67547
|
case "continue-outer": continue outer;
|
|
67485
67548
|
}
|
|
67486
67549
|
}
|
|
@@ -67493,9 +67556,9 @@ var ts;
|
|
|
67493
67556
|
};
|
|
67494
67557
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
67495
67558
|
var combination = discriminantCombinations_1[_a];
|
|
67496
|
-
var
|
|
67497
|
-
if (typeof
|
|
67498
|
-
return
|
|
67559
|
+
var state_8 = _loop_22(combination);
|
|
67560
|
+
if (typeof state_8 === "object")
|
|
67561
|
+
return state_8.value;
|
|
67499
67562
|
}
|
|
67500
67563
|
// Compare the remaining non-discriminant properties of each match.
|
|
67501
67564
|
var result = -1 /* Ternary.True */;
|
|
@@ -68200,7 +68263,7 @@ var ts;
|
|
|
68200
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)) });
|
|
68201
68264
|
links.variances = ts.emptyArray;
|
|
68202
68265
|
var variances = [];
|
|
68203
|
-
var
|
|
68266
|
+
var _loop_24 = function (tp) {
|
|
68204
68267
|
var modifiers = getVarianceModifiers(tp);
|
|
68205
68268
|
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
|
|
68206
68269
|
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
|
|
@@ -68238,7 +68301,7 @@ var ts;
|
|
|
68238
68301
|
};
|
|
68239
68302
|
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
68240
68303
|
var tp = typeParameters_2[_i];
|
|
68241
|
-
|
|
68304
|
+
_loop_24(tp);
|
|
68242
68305
|
}
|
|
68243
68306
|
links.variances = variances;
|
|
68244
68307
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68830,7 +68893,8 @@ var ts;
|
|
|
68830
68893
|
function getOptionalType(type, isProperty) {
|
|
68831
68894
|
if (isProperty === void 0) { isProperty = false; }
|
|
68832
68895
|
ts.Debug.assert(strictNullChecks);
|
|
68833
|
-
|
|
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]);
|
|
68834
68898
|
}
|
|
68835
68899
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
68836
68900
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
@@ -70195,7 +70259,7 @@ var ts;
|
|
|
70195
70259
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
70196
70260
|
// succeed. That would be a pointless and confusing outcome.
|
|
70197
70261
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
70198
|
-
var
|
|
70262
|
+
var _loop_25 = function (i) {
|
|
70199
70263
|
var source_1 = matches ? matches[i] : neverType;
|
|
70200
70264
|
var target_3 = types[i];
|
|
70201
70265
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -70245,7 +70309,7 @@ var ts;
|
|
|
70245
70309
|
inferFromTypes(source_1, target_3);
|
|
70246
70310
|
};
|
|
70247
70311
|
for (var i = 0; i < types.length; i++) {
|
|
70248
|
-
|
|
70312
|
+
_loop_25(i);
|
|
70249
70313
|
}
|
|
70250
70314
|
}
|
|
70251
70315
|
}
|
|
@@ -70709,7 +70773,7 @@ var ts;
|
|
|
70709
70773
|
return name;
|
|
70710
70774
|
}
|
|
70711
70775
|
}
|
|
70712
|
-
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
70776
|
+
if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
|
|
70713
70777
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
70714
70778
|
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
70715
70779
|
}
|
|
@@ -70769,7 +70833,7 @@ var ts;
|
|
|
70769
70833
|
function mapTypesByKeyProperty(types, name) {
|
|
70770
70834
|
var map = new ts.Map();
|
|
70771
70835
|
var count = 0;
|
|
70772
|
-
var
|
|
70836
|
+
var _loop_26 = function (type) {
|
|
70773
70837
|
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
|
|
70774
70838
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70775
70839
|
if (discriminant) {
|
|
@@ -70795,9 +70859,9 @@ var ts;
|
|
|
70795
70859
|
};
|
|
70796
70860
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70797
70861
|
var type = types_15[_i];
|
|
70798
|
-
var
|
|
70799
|
-
if (typeof
|
|
70800
|
-
return
|
|
70862
|
+
var state_10 = _loop_26(type);
|
|
70863
|
+
if (typeof state_10 === "object")
|
|
70864
|
+
return state_10.value;
|
|
70801
70865
|
}
|
|
70802
70866
|
return count >= 10 && count * 2 >= types.length ? map : undefined;
|
|
70803
70867
|
}
|
|
@@ -77252,7 +77316,7 @@ var ts;
|
|
|
77252
77316
|
if (spreadIndex >= 0) {
|
|
77253
77317
|
// Create synthetic arguments from spreads of tuple types.
|
|
77254
77318
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
77255
|
-
var
|
|
77319
|
+
var _loop_27 = function (i) {
|
|
77256
77320
|
var arg = args[i];
|
|
77257
77321
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
77258
77322
|
var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -77269,7 +77333,7 @@ var ts;
|
|
|
77269
77333
|
}
|
|
77270
77334
|
};
|
|
77271
77335
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
77272
|
-
|
|
77336
|
+
_loop_27(i);
|
|
77273
77337
|
}
|
|
77274
77338
|
return effectiveArgs_1;
|
|
77275
77339
|
}
|
|
@@ -77598,7 +77662,7 @@ var ts;
|
|
|
77598
77662
|
var min_3 = Number.MAX_VALUE;
|
|
77599
77663
|
var minIndex = 0;
|
|
77600
77664
|
var i_1 = 0;
|
|
77601
|
-
var
|
|
77665
|
+
var _loop_28 = function (c) {
|
|
77602
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)); };
|
|
77603
77667
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
|
|
77604
77668
|
if (diags_2) {
|
|
@@ -77616,7 +77680,7 @@ var ts;
|
|
|
77616
77680
|
};
|
|
77617
77681
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
77618
77682
|
var c = candidatesForArgumentError_1[_a];
|
|
77619
|
-
|
|
77683
|
+
_loop_28(c);
|
|
77620
77684
|
}
|
|
77621
77685
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
77622
77686
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77774,7 +77838,7 @@ var ts;
|
|
|
77774
77838
|
}
|
|
77775
77839
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77776
77840
|
var parameters = [];
|
|
77777
|
-
var
|
|
77841
|
+
var _loop_29 = function (i) {
|
|
77778
77842
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77779
77843
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77780
77844
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77782,7 +77846,7 @@ var ts;
|
|
|
77782
77846
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77783
77847
|
};
|
|
77784
77848
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77785
|
-
|
|
77849
|
+
_loop_29(i);
|
|
77786
77850
|
}
|
|
77787
77851
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77788
77852
|
var flags = 0 /* SignatureFlags.None */;
|
|
@@ -80564,6 +80628,7 @@ var ts;
|
|
|
80564
80628
|
var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
|
|
80565
80629
|
error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
80566
80630
|
}
|
|
80631
|
+
checkNaNEquality(errorNode, operator, left, right);
|
|
80567
80632
|
reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
|
|
80568
80633
|
return booleanType;
|
|
80569
80634
|
case 102 /* SyntaxKind.InstanceOfKeyword */:
|
|
@@ -80769,6 +80834,26 @@ var ts;
|
|
|
80769
80834
|
return undefined;
|
|
80770
80835
|
}
|
|
80771
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
|
+
}
|
|
80772
80857
|
}
|
|
80773
80858
|
function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
|
|
80774
80859
|
var effectiveLeft = leftType;
|
|
@@ -81806,7 +81891,7 @@ var ts;
|
|
|
81806
81891
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81807
81892
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81808
81893
|
var indexSignatureMap_1 = new ts.Map();
|
|
81809
|
-
var
|
|
81894
|
+
var _loop_30 = function (declaration) {
|
|
81810
81895
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81811
81896
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81812
81897
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81821,7 +81906,7 @@ var ts;
|
|
|
81821
81906
|
};
|
|
81822
81907
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81823
81908
|
var declaration = _a[_i];
|
|
81824
|
-
|
|
81909
|
+
_loop_30(declaration);
|
|
81825
81910
|
}
|
|
81826
81911
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81827
81912
|
if (entry.declarations.length > 1) {
|
|
@@ -85421,7 +85506,7 @@ var ts;
|
|
|
85421
85506
|
var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
|
|
85422
85507
|
name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
|
|
85423
85508
|
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
85424
|
-
var
|
|
85509
|
+
var _loop_31 = function (info) {
|
|
85425
85510
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
85426
85511
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
85427
85512
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -85438,7 +85523,7 @@ var ts;
|
|
|
85438
85523
|
};
|
|
85439
85524
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
85440
85525
|
var info = indexInfos_9[_i];
|
|
85441
|
-
|
|
85526
|
+
_loop_31(info);
|
|
85442
85527
|
}
|
|
85443
85528
|
}
|
|
85444
85529
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -85446,7 +85531,7 @@ var ts;
|
|
|
85446
85531
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
85447
85532
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
|
|
85448
85533
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
85449
|
-
var
|
|
85534
|
+
var _loop_32 = function (info) {
|
|
85450
85535
|
if (info === checkInfo)
|
|
85451
85536
|
return "continue";
|
|
85452
85537
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -85461,7 +85546,7 @@ var ts;
|
|
|
85461
85546
|
};
|
|
85462
85547
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
85463
85548
|
var info = indexInfos_10[_i];
|
|
85464
|
-
|
|
85549
|
+
_loop_32(info);
|
|
85465
85550
|
}
|
|
85466
85551
|
}
|
|
85467
85552
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85781,7 +85866,7 @@ var ts;
|
|
|
85781
85866
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85782
85867
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85783
85868
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85784
|
-
var
|
|
85869
|
+
var _loop_33 = function (member) {
|
|
85785
85870
|
if (ts.hasAmbientModifier(member)) {
|
|
85786
85871
|
return "continue";
|
|
85787
85872
|
}
|
|
@@ -85798,7 +85883,7 @@ var ts;
|
|
|
85798
85883
|
};
|
|
85799
85884
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85800
85885
|
var member = _a[_i];
|
|
85801
|
-
|
|
85886
|
+
_loop_33(member);
|
|
85802
85887
|
}
|
|
85803
85888
|
}
|
|
85804
85889
|
/**
|
|
@@ -85886,7 +85971,7 @@ var ts;
|
|
|
85886
85971
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85887
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
|
|
85888
85973
|
var issuedMemberError = false;
|
|
85889
|
-
var
|
|
85974
|
+
var _loop_34 = function (member) {
|
|
85890
85975
|
if (ts.isStatic(member)) {
|
|
85891
85976
|
return "continue";
|
|
85892
85977
|
}
|
|
@@ -85905,7 +85990,7 @@ var ts;
|
|
|
85905
85990
|
};
|
|
85906
85991
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85907
85992
|
var member = _a[_i];
|
|
85908
|
-
|
|
85993
|
+
_loop_34(member);
|
|
85909
85994
|
}
|
|
85910
85995
|
if (!issuedMemberError) {
|
|
85911
85996
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85976,7 +86061,7 @@ var ts;
|
|
|
85976
86061
|
var _a, _b, _c, _d;
|
|
85977
86062
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85978
86063
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85979
|
-
var
|
|
86064
|
+
var _loop_35 = function (baseProperty) {
|
|
85980
86065
|
var base = getTargetSymbol(baseProperty);
|
|
85981
86066
|
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
|
|
85982
86067
|
return "continue";
|
|
@@ -86086,8 +86171,8 @@ var ts;
|
|
|
86086
86171
|
};
|
|
86087
86172
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
86088
86173
|
var baseProperty = baseProperties_1[_i];
|
|
86089
|
-
var
|
|
86090
|
-
switch (
|
|
86174
|
+
var state_11 = _loop_35(baseProperty);
|
|
86175
|
+
switch (state_11) {
|
|
86091
86176
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
86092
86177
|
}
|
|
86093
86178
|
}
|
|
@@ -115328,6 +115413,7 @@ var ts;
|
|
|
115328
115413
|
writeTrailingSemicolon();
|
|
115329
115414
|
}
|
|
115330
115415
|
function emitExportDeclaration(node) {
|
|
115416
|
+
emitModifiers(node, node.modifiers);
|
|
115331
115417
|
var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node);
|
|
115332
115418
|
writeSpace();
|
|
115333
115419
|
if (node.isTypeOnly) {
|
|
@@ -124930,7 +125016,7 @@ var ts;
|
|
|
124930
125016
|
});
|
|
124931
125017
|
// Sort by paths closest to importing file Name directory
|
|
124932
125018
|
var sortedPaths = [];
|
|
124933
|
-
var
|
|
125019
|
+
var _loop_36 = function (directory) {
|
|
124934
125020
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
124935
125021
|
var pathsInDirectory;
|
|
124936
125022
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -124954,9 +125040,9 @@ var ts;
|
|
|
124954
125040
|
};
|
|
124955
125041
|
var out_directory_1;
|
|
124956
125042
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
124957
|
-
var
|
|
125043
|
+
var state_12 = _loop_36(directory);
|
|
124958
125044
|
directory = out_directory_1;
|
|
124959
|
-
if (
|
|
125045
|
+
if (state_12 === "break")
|
|
124960
125046
|
break;
|
|
124961
125047
|
}
|
|
124962
125048
|
if (allFileNames.size) {
|
|
@@ -125025,7 +125111,7 @@ var ts;
|
|
|
125025
125111
|
}
|
|
125026
125112
|
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
125027
125113
|
for (var key in paths) {
|
|
125028
|
-
var
|
|
125114
|
+
var _loop_37 = function (patternText_1) {
|
|
125029
125115
|
var pattern = ts.normalizePath(patternText_1);
|
|
125030
125116
|
var indexOfStar = pattern.indexOf("*");
|
|
125031
125117
|
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
|
|
@@ -125092,9 +125178,9 @@ var ts;
|
|
|
125092
125178
|
};
|
|
125093
125179
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
125094
125180
|
var patternText_1 = _a[_i];
|
|
125095
|
-
var
|
|
125096
|
-
if (typeof
|
|
125097
|
-
return
|
|
125181
|
+
var state_13 = _loop_37(patternText_1);
|
|
125182
|
+
if (typeof state_13 === "object")
|
|
125183
|
+
return state_13.value;
|
|
125098
125184
|
}
|
|
125099
125185
|
}
|
|
125100
125186
|
function validateEnding(_a) {
|
|
@@ -135433,7 +135519,7 @@ var ts;
|
|
|
135433
135519
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
135434
135520
|
}
|
|
135435
135521
|
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
135436
|
-
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,
|
|
135522
|
+
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;
|
|
135437
135523
|
// Verify if the file is JSX language variant
|
|
135438
135524
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) {
|
|
135439
135525
|
var completionInfo = getJsxClosingTagCompletion(location, sourceFile);
|
|
@@ -135447,7 +135533,7 @@ var ts;
|
|
|
135447
135533
|
return undefined;
|
|
135448
135534
|
}
|
|
135449
135535
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
135450
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer,
|
|
135536
|
+
/*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);
|
|
135451
135537
|
if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) {
|
|
135452
135538
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
135453
135539
|
var keywordEntry = _a[_i];
|
|
@@ -135565,7 +135651,7 @@ var ts;
|
|
|
135565
135651
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
135566
135652
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority };
|
|
135567
135653
|
}
|
|
135568
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
135654
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
135569
135655
|
var _a, _b;
|
|
135570
135656
|
var insertText;
|
|
135571
135657
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
@@ -135621,8 +135707,8 @@ var ts;
|
|
|
135621
135707
|
}
|
|
135622
135708
|
if (originIsResolvedExport(origin)) {
|
|
135623
135709
|
sourceDisplay = [ts.textPart(origin.moduleSpecifier)];
|
|
135624
|
-
if (
|
|
135625
|
-
(_a = getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
135710
|
+
if (importStatementCompletion) {
|
|
135711
|
+
(_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
|
|
135626
135712
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
135627
135713
|
}
|
|
135628
135714
|
}
|
|
@@ -135677,7 +135763,7 @@ var ts;
|
|
|
135677
135763
|
}
|
|
135678
135764
|
if (originIsExport(origin) || originIsResolvedExport(origin)) {
|
|
135679
135765
|
data = originToCompletionEntryData(origin);
|
|
135680
|
-
hasAction = !
|
|
135766
|
+
hasAction = !importStatementCompletion;
|
|
135681
135767
|
}
|
|
135682
135768
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
135683
135769
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
@@ -135700,7 +135786,7 @@ var ts;
|
|
|
135700
135786
|
labelDetails: labelDetails,
|
|
135701
135787
|
isSnippet: isSnippet,
|
|
135702
135788
|
isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
|
|
135703
|
-
isImportStatementCompletion: !!
|
|
135789
|
+
isImportStatementCompletion: !!importStatementCompletion || undefined,
|
|
135704
135790
|
data: data,
|
|
135705
135791
|
};
|
|
135706
135792
|
}
|
|
@@ -136072,19 +136158,16 @@ var ts;
|
|
|
136072
136158
|
};
|
|
136073
136159
|
return unresolvedOrigin;
|
|
136074
136160
|
}
|
|
136075
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
136076
|
-
var
|
|
136077
|
-
var sourceFile = importCompletionNode.getSourceFile();
|
|
136078
|
-
var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile);
|
|
136161
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
136162
|
+
var replacementSpan = importStatementCompletion.replacementSpan;
|
|
136079
136163
|
var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
136080
136164
|
var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ :
|
|
136081
136165
|
origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ :
|
|
136082
136166
|
0 /* ExportKind.Named */;
|
|
136083
136167
|
var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
136084
136168
|
var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true);
|
|
136085
|
-
var
|
|
136086
|
-
var
|
|
136087
|
-
var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
136169
|
+
var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier;
|
|
136170
|
+
var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
136088
136171
|
var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : "";
|
|
136089
136172
|
var suffix = useSemicolons ? ";" : "";
|
|
136090
136173
|
switch (importKind) {
|
|
@@ -136118,7 +136201,7 @@ var ts;
|
|
|
136118
136201
|
return CompletionSource.TypeOnlyAlias;
|
|
136119
136202
|
}
|
|
136120
136203
|
}
|
|
136121
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer,
|
|
136204
|
+
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) {
|
|
136122
136205
|
var _a;
|
|
136123
136206
|
var start = ts.timestamp();
|
|
136124
136207
|
var variableDeclaration = getVariableDeclaration(location);
|
|
@@ -136139,7 +136222,7 @@ var ts;
|
|
|
136139
136222
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
136140
136223
|
var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority;
|
|
136141
136224
|
var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText);
|
|
136142
|
-
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
136225
|
+
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);
|
|
136143
136226
|
if (!entry) {
|
|
136144
136227
|
continue;
|
|
136145
136228
|
}
|
|
@@ -136330,7 +136413,7 @@ var ts;
|
|
|
136330
136413
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
136331
136414
|
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
|
|
136332
136415
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
136333
|
-
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).
|
|
136416
|
+
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
|
|
136334
136417
|
// Import statement completion: 'import c|'
|
|
136335
136418
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
136336
136419
|
}
|
|
@@ -136531,34 +136614,34 @@ var ts;
|
|
|
136531
136614
|
var isStartingCloseTag = false;
|
|
136532
136615
|
var isJsxInitializer = false;
|
|
136533
136616
|
var isJsxIdentifierExpected = false;
|
|
136534
|
-
var
|
|
136617
|
+
var importStatementCompletion;
|
|
136535
136618
|
var location = ts.getTouchingPropertyName(sourceFile, position);
|
|
136536
136619
|
var keywordFilters = 0 /* KeywordCompletionFilters.None */;
|
|
136537
136620
|
var isNewIdentifierLocation = false;
|
|
136538
136621
|
var flags = 0 /* CompletionInfoFlags.None */;
|
|
136539
136622
|
if (contextToken) {
|
|
136540
|
-
var
|
|
136541
|
-
|
|
136542
|
-
|
|
136543
|
-
if (importStatementCompletion.isKeywordOnlyCompletion) {
|
|
136623
|
+
var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
|
|
136624
|
+
if (importStatementCompletionInfo.keywordCompletion) {
|
|
136625
|
+
if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
|
|
136544
136626
|
return {
|
|
136545
136627
|
kind: 4 /* CompletionDataKind.Keywords */,
|
|
136546
|
-
keywordCompletions: [keywordToCompletionEntry(
|
|
136547
|
-
isNewIdentifierLocation: isNewIdentifierLocation,
|
|
136628
|
+
keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)],
|
|
136629
|
+
isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation,
|
|
136548
136630
|
};
|
|
136549
136631
|
}
|
|
136550
|
-
keywordFilters = keywordFiltersFromSyntaxKind(
|
|
136632
|
+
keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion);
|
|
136551
136633
|
}
|
|
136552
|
-
if (
|
|
136634
|
+
if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
|
|
136553
136635
|
// Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
|
|
136554
136636
|
// added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
|
|
136555
136637
|
// is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
|
|
136556
136638
|
// to opt in with the `includeCompletionsForImportStatements` user preference.
|
|
136557
|
-
importCompletionNode = importStatementCompletion.replacementNode;
|
|
136558
136639
|
flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */;
|
|
136640
|
+
importStatementCompletion = importStatementCompletionInfo;
|
|
136641
|
+
isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
|
|
136559
136642
|
}
|
|
136560
136643
|
// Bail out if this is a known invalid completion location
|
|
136561
|
-
if (!
|
|
136644
|
+
if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
|
|
136562
136645
|
log("Returning an empty list because completion was requested in an invalid position.");
|
|
136563
136646
|
return keywordFilters
|
|
136564
136647
|
? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation())
|
|
@@ -136604,7 +136687,7 @@ var ts;
|
|
|
136604
136687
|
return undefined;
|
|
136605
136688
|
}
|
|
136606
136689
|
}
|
|
136607
|
-
else if (!
|
|
136690
|
+
else if (!importStatementCompletion) {
|
|
136608
136691
|
// <UI.Test /* completion position */ />
|
|
136609
136692
|
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
|
|
136610
136693
|
// Then, try to get a JSX container and its associated attributes type.
|
|
@@ -136747,7 +136830,7 @@ var ts;
|
|
|
136747
136830
|
isTypeOnlyLocation: isTypeOnlyLocation,
|
|
136748
136831
|
isJsxIdentifierExpected: isJsxIdentifierExpected,
|
|
136749
136832
|
isRightOfOpenTag: isRightOfOpenTag,
|
|
136750
|
-
|
|
136833
|
+
importStatementCompletion: importStatementCompletion,
|
|
136751
136834
|
hasUnresolvedAutoImports: hasUnresolvedAutoImports,
|
|
136752
136835
|
flags: flags,
|
|
136753
136836
|
};
|
|
@@ -137001,7 +137084,7 @@ var ts;
|
|
|
137001
137084
|
return 1 /* GlobalsSearch.Success */;
|
|
137002
137085
|
}
|
|
137003
137086
|
function tryGetImportCompletionSymbols() {
|
|
137004
|
-
if (!
|
|
137087
|
+
if (!importStatementCompletion)
|
|
137005
137088
|
return 0 /* GlobalsSearch.Continue */;
|
|
137006
137089
|
isNewIdentifierLocation = true;
|
|
137007
137090
|
collectAutoImports();
|
|
@@ -137084,7 +137167,7 @@ var ts;
|
|
|
137084
137167
|
}
|
|
137085
137168
|
function shouldOfferImportCompletions() {
|
|
137086
137169
|
// If already typing an import statement, provide completions for it.
|
|
137087
|
-
if (
|
|
137170
|
+
if (importStatementCompletion)
|
|
137088
137171
|
return true;
|
|
137089
137172
|
// If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
|
|
137090
137173
|
if (isNonContextualObjectLiteral)
|
|
@@ -137114,7 +137197,7 @@ var ts;
|
|
|
137114
137197
|
}
|
|
137115
137198
|
function isTypeOnlyCompletion() {
|
|
137116
137199
|
return insideJsDocTagTypeExpression
|
|
137117
|
-
|| !!
|
|
137200
|
+
|| !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
|
|
137118
137201
|
|| !isContextTokenValueLocation(contextToken) &&
|
|
137119
137202
|
(ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
|
|
137120
137203
|
|| ts.isPartOfTypeNode(location)
|
|
@@ -137164,8 +137247,7 @@ var ts;
|
|
|
137164
137247
|
flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */;
|
|
137165
137248
|
// import { type | -> token text should be blank
|
|
137166
137249
|
var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
|
|
137167
|
-
&&
|
|
137168
|
-
&& couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
|
|
137250
|
+
&& importStatementCompletion;
|
|
137169
137251
|
var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" :
|
|
137170
137252
|
previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() :
|
|
137171
137253
|
"";
|
|
@@ -137173,14 +137255,14 @@ var ts;
|
|
|
137173
137255
|
var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken);
|
|
137174
137256
|
var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
137175
137257
|
var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
137176
|
-
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!
|
|
137258
|
+
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
137177
137259
|
exportInfo.search(sourceFile.path,
|
|
137178
137260
|
/*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
|
|
137179
137261
|
if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
|
|
137180
137262
|
return false;
|
|
137181
137263
|
if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
|
|
137182
137264
|
return false;
|
|
137183
|
-
if (!isTypeOnlyLocation && !
|
|
137265
|
+
if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */))
|
|
137184
137266
|
return false;
|
|
137185
137267
|
if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */)))
|
|
137186
137268
|
return false;
|
|
@@ -137261,7 +137343,7 @@ var ts;
|
|
|
137261
137343
|
return;
|
|
137262
137344
|
}
|
|
137263
137345
|
symbolToOriginInfoMap[symbols.length] = origin;
|
|
137264
|
-
symbolToSortTextMap[symbolId] =
|
|
137346
|
+
symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
|
|
137265
137347
|
symbols.push(symbol);
|
|
137266
137348
|
}
|
|
137267
137349
|
/* Mutates `symbols` and `symbolToOriginInfoMap`. */
|
|
@@ -138528,6 +138610,7 @@ var ts;
|
|
|
138528
138610
|
return undefined;
|
|
138529
138611
|
}
|
|
138530
138612
|
function getImportStatementCompletionInfo(contextToken) {
|
|
138613
|
+
var _a, _b, _c;
|
|
138531
138614
|
var keywordCompletion;
|
|
138532
138615
|
var isKeywordOnlyCompletion = false;
|
|
138533
138616
|
var candidate = getCandidate();
|
|
@@ -138535,9 +138618,9 @@ var ts;
|
|
|
138535
138618
|
isKeywordOnlyCompletion: isKeywordOnlyCompletion,
|
|
138536
138619
|
keywordCompletion: keywordCompletion,
|
|
138537
138620
|
isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */),
|
|
138538
|
-
|
|
138539
|
-
|
|
138540
|
-
|
|
138621
|
+
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),
|
|
138622
|
+
couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken),
|
|
138623
|
+
replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate),
|
|
138541
138624
|
};
|
|
138542
138625
|
function getCandidate() {
|
|
138543
138626
|
var parent = contextToken.parent;
|
|
@@ -138579,14 +138662,71 @@ var ts;
|
|
|
138579
138662
|
return undefined;
|
|
138580
138663
|
}
|
|
138581
138664
|
}
|
|
138665
|
+
function getSingleLineReplacementSpanForImportCompletionNode(node) {
|
|
138666
|
+
var _a, _b, _c;
|
|
138667
|
+
if (!node)
|
|
138668
|
+
return undefined;
|
|
138669
|
+
var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node;
|
|
138670
|
+
var sourceFile = top.getSourceFile();
|
|
138671
|
+
if (ts.rangeIsOnSingleLine(top, sourceFile)) {
|
|
138672
|
+
return ts.createTextSpanFromNode(top, sourceFile);
|
|
138673
|
+
}
|
|
138674
|
+
// ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration
|
|
138675
|
+
ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */);
|
|
138676
|
+
// Guess which point in the import might actually be a later statement parsed as part of the import
|
|
138677
|
+
// during parser recovery - either in the middle of named imports, or the module specifier.
|
|
138678
|
+
var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */
|
|
138679
|
+
? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier
|
|
138680
|
+
: top.moduleReference;
|
|
138681
|
+
var withoutModuleSpecifier = {
|
|
138682
|
+
pos: top.getFirstToken().getStart(),
|
|
138683
|
+
end: potentialSplitPoint.pos,
|
|
138684
|
+
};
|
|
138685
|
+
// The module specifier/reference was previously found to be missing, empty, or
|
|
138686
|
+
// not a string literal - in this last case, it's likely that statement on a following
|
|
138687
|
+
// line was parsed as the module specifier of a partially-typed import, e.g.
|
|
138688
|
+
// import Foo|
|
|
138689
|
+
// interface Blah {}
|
|
138690
|
+
// This appears to be a multiline-import, and editors can't replace multiple lines.
|
|
138691
|
+
// But if everything but the "module specifier" is on one line, by this point we can
|
|
138692
|
+
// assume that the "module specifier" is actually just another statement, and return
|
|
138693
|
+
// the single-line range of the import excluding that probable statement.
|
|
138694
|
+
if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) {
|
|
138695
|
+
return ts.createTextSpanFromRange(withoutModuleSpecifier);
|
|
138696
|
+
}
|
|
138697
|
+
}
|
|
138698
|
+
// Tries to identify the first named import that is not really a named import, but rather
|
|
138699
|
+
// just parser recovery for a situation like:
|
|
138700
|
+
// import { Foo|
|
|
138701
|
+
// interface Bar {}
|
|
138702
|
+
// in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller
|
|
138703
|
+
// will also check if this token is on a separate line from the rest of the import.
|
|
138704
|
+
function getPotentiallyInvalidImportSpecifier(namedBindings) {
|
|
138705
|
+
var _a;
|
|
138706
|
+
return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) {
|
|
138707
|
+
var _a;
|
|
138708
|
+
return !e.propertyName &&
|
|
138709
|
+
ts.isStringANonContextualKeyword(e.name.text) &&
|
|
138710
|
+
((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */;
|
|
138711
|
+
});
|
|
138712
|
+
}
|
|
138582
138713
|
function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) {
|
|
138583
138714
|
return ts.isImportSpecifier(importSpecifier)
|
|
138584
138715
|
&& (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken));
|
|
138585
138716
|
}
|
|
138586
138717
|
function canCompleteFromNamedBindings(namedBindings) {
|
|
138587
|
-
|
|
138588
|
-
|
|
138589
|
-
|
|
138718
|
+
if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) {
|
|
138719
|
+
return false;
|
|
138720
|
+
}
|
|
138721
|
+
if (ts.isNamedImports(namedBindings)) {
|
|
138722
|
+
// We can only complete on named imports if there are no other named imports already,
|
|
138723
|
+
// but parser recovery sometimes puts later statements in the named imports list, so
|
|
138724
|
+
// we try to only consider the probably-valid ones.
|
|
138725
|
+
var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings);
|
|
138726
|
+
var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length;
|
|
138727
|
+
return validImports < 2;
|
|
138728
|
+
}
|
|
138729
|
+
return true;
|
|
138590
138730
|
}
|
|
138591
138731
|
function isModuleSpecifierMissingOrEmpty(specifier) {
|
|
138592
138732
|
var _a;
|
|
@@ -146621,6 +146761,10 @@ var ts;
|
|
|
146621
146761
|
pushSelectionCommentRange(comment.pos, comment.end);
|
|
146622
146762
|
}
|
|
146623
146763
|
if (positionShouldSnapToNode(sourceFile, pos, node)) {
|
|
146764
|
+
if (ts.isFunctionBody(node)
|
|
146765
|
+
&& ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) {
|
|
146766
|
+
pushSelectionRange(node.getStart(sourceFile), node.getEnd());
|
|
146767
|
+
}
|
|
146624
146768
|
// 1. Blocks are effectively redundant with SyntaxLists.
|
|
146625
146769
|
// 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
|
|
146626
146770
|
// of things that should be considered independently.
|
|
@@ -157319,7 +157463,7 @@ var ts;
|
|
|
157319
157463
|
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
|
|
157320
157464
|
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
157321
157465
|
return;
|
|
157322
|
-
var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157466
|
+
var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157323
157467
|
if (declaration === undefined)
|
|
157324
157468
|
return;
|
|
157325
157469
|
if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) {
|
|
@@ -157353,14 +157497,6 @@ var ts;
|
|
|
157353
157497
|
}
|
|
157354
157498
|
}
|
|
157355
157499
|
}
|
|
157356
|
-
function findAncestorMatchingSpan(sourceFile, span) {
|
|
157357
|
-
var end = ts.textSpanEnd(span);
|
|
157358
|
-
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
157359
|
-
while (token.end < end) {
|
|
157360
|
-
token = token.parent;
|
|
157361
|
-
}
|
|
157362
|
-
return token;
|
|
157363
|
-
}
|
|
157364
157500
|
function tryGetConstraintFromDiagnosticMessage(messageText) {
|
|
157365
157501
|
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1];
|
|
157366
157502
|
return constraint;
|
|
@@ -158241,7 +158377,7 @@ var ts;
|
|
|
158241
158377
|
return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
158242
158378
|
}
|
|
158243
158379
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
158244
|
-
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
158380
|
+
if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
158245
158381
|
return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
|
|
158246
158382
|
}
|
|
158247
158383
|
return undefined;
|
|
@@ -158906,6 +159042,63 @@ var ts;
|
|
|
158906
159042
|
})(ts || (ts = {}));
|
|
158907
159043
|
/* @internal */
|
|
158908
159044
|
var ts;
|
|
159045
|
+
(function (ts) {
|
|
159046
|
+
var codefix;
|
|
159047
|
+
(function (codefix) {
|
|
159048
|
+
var fixId = "fixNaNEquality";
|
|
159049
|
+
var errorCodes = [
|
|
159050
|
+
ts.Diagnostics.This_condition_will_always_return_0.code,
|
|
159051
|
+
];
|
|
159052
|
+
codefix.registerCodeFix({
|
|
159053
|
+
errorCodes: errorCodes,
|
|
159054
|
+
getCodeActions: function (context) {
|
|
159055
|
+
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
159056
|
+
var info = getInfo(program, sourceFile, span);
|
|
159057
|
+
if (info === undefined)
|
|
159058
|
+
return;
|
|
159059
|
+
var suggestion = info.suggestion, expression = info.expression, arg = info.arg;
|
|
159060
|
+
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); });
|
|
159061
|
+
return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
159062
|
+
},
|
|
159063
|
+
fixIds: [fixId],
|
|
159064
|
+
getAllCodeActions: function (context) {
|
|
159065
|
+
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
159066
|
+
var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length));
|
|
159067
|
+
if (info) {
|
|
159068
|
+
doChange(changes, diag.file, info.arg, info.expression);
|
|
159069
|
+
}
|
|
159070
|
+
});
|
|
159071
|
+
}
|
|
159072
|
+
});
|
|
159073
|
+
function getInfo(program, sourceFile, span) {
|
|
159074
|
+
var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
|
|
159075
|
+
if (diag === undefined || diag.relatedInformation === undefined)
|
|
159076
|
+
return;
|
|
159077
|
+
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; });
|
|
159078
|
+
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
159079
|
+
return;
|
|
159080
|
+
var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
159081
|
+
if (token === undefined)
|
|
159082
|
+
return;
|
|
159083
|
+
if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) {
|
|
159084
|
+
return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token };
|
|
159085
|
+
}
|
|
159086
|
+
return undefined;
|
|
159087
|
+
}
|
|
159088
|
+
function doChange(changes, sourceFile, arg, expression) {
|
|
159089
|
+
var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]);
|
|
159090
|
+
var operator = expression.operatorToken.kind;
|
|
159091
|
+
changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */
|
|
159092
|
+
? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression);
|
|
159093
|
+
}
|
|
159094
|
+
function getSuggestion(messageText) {
|
|
159095
|
+
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1];
|
|
159096
|
+
return suggestion;
|
|
159097
|
+
}
|
|
159098
|
+
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
159099
|
+
})(ts || (ts = {}));
|
|
159100
|
+
/* @internal */
|
|
159101
|
+
var ts;
|
|
158909
159102
|
(function (ts) {
|
|
158910
159103
|
var codefix;
|
|
158911
159104
|
(function (codefix) {
|
|
@@ -161623,6 +161816,15 @@ var ts;
|
|
|
161623
161816
|
symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); });
|
|
161624
161817
|
}
|
|
161625
161818
|
codefix.importSymbols = importSymbols;
|
|
161819
|
+
function findAncestorMatchingSpan(sourceFile, span) {
|
|
161820
|
+
var end = ts.textSpanEnd(span);
|
|
161821
|
+
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
161822
|
+
while (token.end < end) {
|
|
161823
|
+
token = token.parent;
|
|
161824
|
+
}
|
|
161825
|
+
return token;
|
|
161826
|
+
}
|
|
161827
|
+
codefix.findAncestorMatchingSpan = findAncestorMatchingSpan;
|
|
161626
161828
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
161627
161829
|
})(ts || (ts = {}));
|
|
161628
161830
|
/* @internal */
|