typescript 4.9.0-dev.20220919 → 4.9.0-dev.20220921
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 +5 -0
- package/lib/es/diagnosticMessages.generated.json +5 -0
- package/lib/it/diagnosticMessages.generated.json +5 -0
- package/lib/pl/diagnosticMessages.generated.json +5 -0
- package/lib/tr/diagnosticMessages.generated.json +5 -0
- package/lib/tsc.js +214 -125
- package/lib/tsserver.js +415 -213
- package/lib/tsserverlibrary.js +415 -213
- package/lib/typescript.js +414 -211
- package/lib/typescriptServices.js +414 -211
- package/lib/typingsInstaller.js +243 -145
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
112
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220921");
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -2693,7 +2693,7 @@ var ts;
|
|
|
2693
2693
|
if (typeof func !== "function") {
|
|
2694
2694
|
return "";
|
|
2695
2695
|
}
|
|
2696
|
-
else if (
|
|
2696
|
+
else if (ts.hasProperty(func, "name")) {
|
|
2697
2697
|
return func.name;
|
|
2698
2698
|
}
|
|
2699
2699
|
else {
|
|
@@ -3018,7 +3018,7 @@ var ts;
|
|
|
3018
3018
|
];
|
|
3019
3019
|
for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
|
|
3020
3020
|
var ctor = nodeConstructors_1[_i];
|
|
3021
|
-
if (!ctor.prototype
|
|
3021
|
+
if (!ts.hasProperty(ctor.prototype, "__debugKind")) {
|
|
3022
3022
|
Object.defineProperties(ctor.prototype, {
|
|
3023
3023
|
// for use with vscode-js-debug's new customDescriptionGenerator in launch.json
|
|
3024
3024
|
__tsDebuggerDisplay: {
|
|
@@ -3873,7 +3873,6 @@ var ts;
|
|
|
3873
3873
|
var typeCatalog = []; // NB: id is index + 1
|
|
3874
3874
|
var legendPath;
|
|
3875
3875
|
var legend = [];
|
|
3876
|
-
;
|
|
3877
3876
|
/** Starts tracing for the given project. */
|
|
3878
3877
|
function startTracing(tracingMode, traceDir, configFilePath) {
|
|
3879
3878
|
ts.Debug.assert(!ts.tracing, "Tracing already started");
|
|
@@ -8705,8 +8704,6 @@ var ts;
|
|
|
8705
8704
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
8706
8705
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
8707
8706
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
8708
|
-
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
8709
|
-
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
8710
8707
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8711
8708
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8712
8709
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -8955,6 +8952,7 @@ var ts;
|
|
|
8955
8952
|
Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
|
|
8956
8953
|
Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
|
|
8957
8954
|
Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
|
|
8955
|
+
Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
|
|
8958
8956
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
8959
8957
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
8960
8958
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
@@ -9135,6 +9133,7 @@ var ts;
|
|
|
9135
9133
|
_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?"),
|
|
9136
9134
|
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."),
|
|
9137
9135
|
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."),
|
|
9136
|
+
This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
9138
9137
|
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}'."),
|
|
9139
9138
|
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}'."),
|
|
9140
9139
|
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}'."),
|
|
@@ -10077,6 +10076,8 @@ var ts;
|
|
|
10077
10076
|
Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
|
|
10078
10077
|
Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
|
|
10079
10078
|
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}'"),
|
|
10079
|
+
Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."),
|
|
10080
|
+
Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
10080
10081
|
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."),
|
|
10081
10082
|
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'."),
|
|
10082
10083
|
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?"),
|
|
@@ -10338,7 +10339,7 @@ var ts;
|
|
|
10338
10339
|
ts.stringToToken = stringToToken;
|
|
10339
10340
|
/* @internal */
|
|
10340
10341
|
function computeLineStarts(text) {
|
|
10341
|
-
var result =
|
|
10342
|
+
var result = [];
|
|
10342
10343
|
var pos = 0;
|
|
10343
10344
|
var lineStart = 0;
|
|
10344
10345
|
while (pos < text.length) {
|
|
@@ -11899,12 +11900,36 @@ var ts;
|
|
|
11899
11900
|
pos++;
|
|
11900
11901
|
return token = 0 /* SyntaxKind.Unknown */;
|
|
11901
11902
|
}
|
|
11902
|
-
|
|
11903
|
+
var charAfterHash = codePointAt(text, pos + 1);
|
|
11904
|
+
if (charAfterHash === 92 /* CharacterCodes.backslash */) {
|
|
11905
|
+
pos++;
|
|
11906
|
+
var extendedCookedChar_1 = peekExtendedUnicodeEscape();
|
|
11907
|
+
if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) {
|
|
11908
|
+
pos += 3;
|
|
11909
|
+
tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */;
|
|
11910
|
+
tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
|
|
11911
|
+
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
11912
|
+
}
|
|
11913
|
+
var cookedChar_1 = peekUnicodeEscape();
|
|
11914
|
+
if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) {
|
|
11915
|
+
pos += 6;
|
|
11916
|
+
tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */;
|
|
11917
|
+
tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts();
|
|
11918
|
+
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
11919
|
+
}
|
|
11920
|
+
pos--;
|
|
11921
|
+
}
|
|
11922
|
+
if (isIdentifierStart(charAfterHash, languageVersion)) {
|
|
11903
11923
|
pos++;
|
|
11904
|
-
scanIdentifier
|
|
11924
|
+
// We're relying on scanIdentifier's behavior and adjusting the token kind after the fact.
|
|
11925
|
+
// Notably absent from this block is the fact that calling a function named "scanIdentifier",
|
|
11926
|
+
// but identifiers don't include '#', and that function doesn't deal with it at all.
|
|
11927
|
+
// This works because 'scanIdentifier' tries to reuse source characters and builds up substrings;
|
|
11928
|
+
// however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us.
|
|
11929
|
+
scanIdentifier(charAfterHash, languageVersion);
|
|
11905
11930
|
}
|
|
11906
11931
|
else {
|
|
11907
|
-
tokenValue =
|
|
11932
|
+
tokenValue = "#";
|
|
11908
11933
|
error(ts.Diagnostics.Invalid_character, pos++, charSize(ch));
|
|
11909
11934
|
}
|
|
11910
11935
|
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
@@ -13471,7 +13496,7 @@ var ts;
|
|
|
13471
13496
|
// Node Arrays
|
|
13472
13497
|
/* @internal */
|
|
13473
13498
|
function isNodeArray(array) {
|
|
13474
|
-
return
|
|
13499
|
+
return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end");
|
|
13475
13500
|
}
|
|
13476
13501
|
ts.isNodeArray = isNodeArray;
|
|
13477
13502
|
// Literals
|
|
@@ -14943,7 +14968,6 @@ var ts;
|
|
|
14943
14968
|
return emitNode && emitNode.flags || 0;
|
|
14944
14969
|
}
|
|
14945
14970
|
ts.getEmitFlags = getEmitFlags;
|
|
14946
|
-
;
|
|
14947
14971
|
function getScriptTargetFeatures() {
|
|
14948
14972
|
return {
|
|
14949
14973
|
es2015: {
|
|
@@ -19669,7 +19693,7 @@ var ts;
|
|
|
19669
19693
|
}
|
|
19670
19694
|
function isWatchSet(options) {
|
|
19671
19695
|
// Firefox has Object.prototype.watch
|
|
19672
|
-
return options.watch &&
|
|
19696
|
+
return options.watch && ts.hasProperty(options, "watch");
|
|
19673
19697
|
}
|
|
19674
19698
|
ts.isWatchSet = isWatchSet;
|
|
19675
19699
|
function closeFileWatcher(watcher) {
|
|
@@ -26954,7 +26978,7 @@ var ts;
|
|
|
26954
26978
|
clone.transformFlags = node.transformFlags;
|
|
26955
26979
|
setOriginalNode(clone, node);
|
|
26956
26980
|
for (var key in node) {
|
|
26957
|
-
if (
|
|
26981
|
+
if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) {
|
|
26958
26982
|
continue;
|
|
26959
26983
|
}
|
|
26960
26984
|
clone[key] = node[key];
|
|
@@ -31842,7 +31866,6 @@ var ts;
|
|
|
31842
31866
|
visitNodes(cbNode, cbNodes, node.parameters) ||
|
|
31843
31867
|
visitNode(cbNode, node.type);
|
|
31844
31868
|
}
|
|
31845
|
-
;
|
|
31846
31869
|
function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) {
|
|
31847
31870
|
return visitNodes(cbNode, cbNodes, node.types);
|
|
31848
31871
|
}
|
|
@@ -33144,7 +33167,7 @@ var ts;
|
|
|
33144
33167
|
}
|
|
33145
33168
|
function parsePrivateIdentifier() {
|
|
33146
33169
|
var pos = getNodePos();
|
|
33147
|
-
var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.
|
|
33170
|
+
var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue()));
|
|
33148
33171
|
nextToken();
|
|
33149
33172
|
return finishNode(node, pos);
|
|
33150
33173
|
}
|
|
@@ -43158,7 +43181,7 @@ var ts;
|
|
|
43158
43181
|
function convertCompilerOptionsForTelemetry(opts) {
|
|
43159
43182
|
var out = {};
|
|
43160
43183
|
for (var key in opts) {
|
|
43161
|
-
if (
|
|
43184
|
+
if (ts.hasProperty(opts, key)) {
|
|
43162
43185
|
var type = getOptionFromName(key);
|
|
43163
43186
|
if (type !== undefined) { // Ignore unknown options
|
|
43164
43187
|
out[key] = getOptionValueWithEmptyStrings(opts[key], type);
|
|
@@ -49662,7 +49685,8 @@ var ts;
|
|
|
49662
49685
|
var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
|
|
49663
49686
|
emptyTypeLiteralSymbol.members = ts.createSymbolTable();
|
|
49664
49687
|
var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49665
|
-
var
|
|
49688
|
+
var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49689
|
+
var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
|
|
49666
49690
|
var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49667
49691
|
emptyGenericType.instantiations = new ts.Map();
|
|
49668
49692
|
var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
@@ -49776,6 +49800,8 @@ var ts;
|
|
|
49776
49800
|
var deferredGlobalOmitSymbol;
|
|
49777
49801
|
var deferredGlobalAwaitedSymbol;
|
|
49778
49802
|
var deferredGlobalBigIntType;
|
|
49803
|
+
var deferredGlobalNaNSymbol;
|
|
49804
|
+
var deferredGlobalRecordSymbol;
|
|
49779
49805
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49780
49806
|
var flowLoopStart = 0;
|
|
49781
49807
|
var flowLoopCount = 0;
|
|
@@ -50571,12 +50597,13 @@ var ts;
|
|
|
50571
50597
|
* the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
|
|
50572
50598
|
* the given name can be found.
|
|
50573
50599
|
*
|
|
50600
|
+
* @param nameNotFoundMessage If defined, we will report errors found during resolve.
|
|
50574
50601
|
* @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
|
|
50575
50602
|
*/
|
|
50576
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals,
|
|
50603
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) {
|
|
50577
50604
|
if (excludeGlobals === void 0) { excludeGlobals = false; }
|
|
50578
|
-
if (
|
|
50579
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals,
|
|
50605
|
+
if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; }
|
|
50606
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
|
|
50580
50607
|
}
|
|
50581
50608
|
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
50582
50609
|
var _a, _b, _c;
|
|
@@ -50734,7 +50761,9 @@ var ts;
|
|
|
50734
50761
|
// TypeScript 1.0 spec (April 2014): 3.4.1
|
|
50735
50762
|
// The scope of a type parameter extends over the entire declaration with which the type
|
|
50736
50763
|
// parameter list is associated, with the exception of static member declarations in classes.
|
|
50737
|
-
|
|
50764
|
+
if (nameNotFoundMessage) {
|
|
50765
|
+
error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
50766
|
+
}
|
|
50738
50767
|
return undefined;
|
|
50739
50768
|
}
|
|
50740
50769
|
break loop;
|
|
@@ -50772,7 +50801,9 @@ var ts;
|
|
|
50772
50801
|
if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) {
|
|
50773
50802
|
// A reference to this grandparent's type parameters would be an error
|
|
50774
50803
|
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) {
|
|
50775
|
-
|
|
50804
|
+
if (nameNotFoundMessage) {
|
|
50805
|
+
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
50806
|
+
}
|
|
50776
50807
|
return undefined;
|
|
50777
50808
|
}
|
|
50778
50809
|
}
|
|
@@ -50968,7 +50999,7 @@ var ts;
|
|
|
50968
50999
|
}
|
|
50969
51000
|
return undefined;
|
|
50970
51001
|
}
|
|
50971
|
-
else if (checkAndReportErrorForInvalidInitializer()) {
|
|
51002
|
+
else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
|
|
50972
51003
|
return undefined;
|
|
50973
51004
|
}
|
|
50974
51005
|
// Perform extra checks only if error reporting was requested
|
|
@@ -57129,7 +57160,6 @@ var ts;
|
|
|
57129
57160
|
return container;
|
|
57130
57161
|
}
|
|
57131
57162
|
}
|
|
57132
|
-
;
|
|
57133
57163
|
}
|
|
57134
57164
|
/** Create a synthetic property access flow node after the last statement of the file */
|
|
57135
57165
|
function getFlowTypeFromCommonJSExport(symbol) {
|
|
@@ -60259,7 +60289,7 @@ var ts;
|
|
|
60259
60289
|
var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
|
|
60260
60290
|
// If the symbols are instances of one another with identical types - consider the symbols
|
|
60261
60291
|
// equivalent and just use the first one, which thus allows us to avoid eliding private
|
|
60262
|
-
// 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
|
|
60263
60293
|
if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
|
|
60264
60294
|
// If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
|
|
60265
60295
|
// to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
|
|
@@ -60307,7 +60337,11 @@ var ts;
|
|
|
60307
60337
|
}
|
|
60308
60338
|
}
|
|
60309
60339
|
}
|
|
60310
|
-
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())))) {
|
|
60311
60345
|
// No property was found, or, in a union, a property has a private or protected declaration in one
|
|
60312
60346
|
// constituent, but is missing or has a different declaration in another constituent.
|
|
60313
60347
|
return undefined;
|
|
@@ -60409,6 +60443,33 @@ var ts;
|
|
|
60409
60443
|
}
|
|
60410
60444
|
return property;
|
|
60411
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
|
+
}
|
|
60412
60473
|
function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
|
|
60413
60474
|
var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
60414
60475
|
// We need to filter out partial properties in union types
|
|
@@ -61123,7 +61184,7 @@ var ts;
|
|
|
61123
61184
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
61124
61185
|
if (indexSymbol.declarations) {
|
|
61125
61186
|
var indexInfos_4 = [];
|
|
61126
|
-
var
|
|
61187
|
+
var _loop_15 = function (declaration) {
|
|
61127
61188
|
if (declaration.parameters.length === 1) {
|
|
61128
61189
|
var parameter = declaration.parameters[0];
|
|
61129
61190
|
if (parameter.type) {
|
|
@@ -61137,7 +61198,7 @@ var ts;
|
|
|
61137
61198
|
};
|
|
61138
61199
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
61139
61200
|
var declaration = _a[_i];
|
|
61140
|
-
|
|
61201
|
+
_loop_15(declaration);
|
|
61141
61202
|
}
|
|
61142
61203
|
return indexInfos_4;
|
|
61143
61204
|
}
|
|
@@ -61154,7 +61215,7 @@ var ts;
|
|
|
61154
61215
|
var _a;
|
|
61155
61216
|
var inferences;
|
|
61156
61217
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
61157
|
-
var
|
|
61218
|
+
var _loop_16 = function (declaration) {
|
|
61158
61219
|
if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
|
|
61159
61220
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
61160
61221
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -61218,7 +61279,7 @@ var ts;
|
|
|
61218
61279
|
};
|
|
61219
61280
|
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
61220
61281
|
var declaration = _b[_i];
|
|
61221
|
-
|
|
61282
|
+
_loop_16(declaration);
|
|
61222
61283
|
}
|
|
61223
61284
|
}
|
|
61224
61285
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61875,6 +61936,13 @@ var ts;
|
|
|
61875
61936
|
function getGlobalBigIntType() {
|
|
61876
61937
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61877
61938
|
}
|
|
61939
|
+
function getGlobalNaNSymbol() {
|
|
61940
|
+
return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
|
|
61941
|
+
}
|
|
61942
|
+
function getGlobalRecordSymbol() {
|
|
61943
|
+
deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61944
|
+
return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
|
|
61945
|
+
}
|
|
61878
61946
|
/**
|
|
61879
61947
|
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
|
61880
61948
|
*/
|
|
@@ -62111,7 +62179,7 @@ var ts;
|
|
|
62111
62179
|
var lastRequiredIndex = -1;
|
|
62112
62180
|
var firstRestIndex = -1;
|
|
62113
62181
|
var lastOptionalOrRestIndex = -1;
|
|
62114
|
-
var
|
|
62182
|
+
var _loop_17 = function (i) {
|
|
62115
62183
|
var type = elementTypes[i];
|
|
62116
62184
|
var flags = target.elementFlags[i];
|
|
62117
62185
|
if (flags & 8 /* ElementFlags.Variadic */) {
|
|
@@ -62141,9 +62209,9 @@ var ts;
|
|
|
62141
62209
|
}
|
|
62142
62210
|
};
|
|
62143
62211
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
62144
|
-
var
|
|
62145
|
-
if (typeof
|
|
62146
|
-
return
|
|
62212
|
+
var state_5 = _loop_17(i);
|
|
62213
|
+
if (typeof state_5 === "object")
|
|
62214
|
+
return state_5.value;
|
|
62147
62215
|
}
|
|
62148
62216
|
// Turn optional elements preceding the last required element into required elements
|
|
62149
62217
|
for (var i = 0; i < lastRequiredIndex; i++) {
|
|
@@ -62171,7 +62239,7 @@ var ts;
|
|
|
62171
62239
|
if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
|
|
62172
62240
|
lastOptionalOrRestIndex = expandedFlags.length;
|
|
62173
62241
|
}
|
|
62174
|
-
expandedTypes.push(type);
|
|
62242
|
+
expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
|
|
62175
62243
|
expandedFlags.push(flags);
|
|
62176
62244
|
if (expandedDeclarations && declaration) {
|
|
62177
62245
|
expandedDeclarations.push(declaration);
|
|
@@ -62337,7 +62405,7 @@ var ts;
|
|
|
62337
62405
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
62338
62406
|
if (templates.length) {
|
|
62339
62407
|
var i = types.length;
|
|
62340
|
-
var
|
|
62408
|
+
var _loop_18 = function () {
|
|
62341
62409
|
i--;
|
|
62342
62410
|
var t = types[i];
|
|
62343
62411
|
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -62345,7 +62413,7 @@ var ts;
|
|
|
62345
62413
|
}
|
|
62346
62414
|
};
|
|
62347
62415
|
while (i > 0) {
|
|
62348
|
-
|
|
62416
|
+
_loop_18();
|
|
62349
62417
|
}
|
|
62350
62418
|
}
|
|
62351
62419
|
}
|
|
@@ -62422,14 +62490,14 @@ var ts;
|
|
|
62422
62490
|
var namedUnions = [];
|
|
62423
62491
|
addNamedUnions(namedUnions, types);
|
|
62424
62492
|
var reducedTypes = [];
|
|
62425
|
-
var
|
|
62493
|
+
var _loop_19 = function (t) {
|
|
62426
62494
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
62427
62495
|
reducedTypes.push(t);
|
|
62428
62496
|
}
|
|
62429
62497
|
};
|
|
62430
62498
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
62431
62499
|
var t = typeSet_1[_i];
|
|
62432
|
-
|
|
62500
|
+
_loop_19(t);
|
|
62433
62501
|
}
|
|
62434
62502
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
62435
62503
|
return namedUnions[0];
|
|
@@ -63659,7 +63727,7 @@ var ts;
|
|
|
63659
63727
|
var result;
|
|
63660
63728
|
var extraTypes;
|
|
63661
63729
|
var tailCount = 0;
|
|
63662
|
-
var
|
|
63730
|
+
var _loop_20 = function () {
|
|
63663
63731
|
if (tailCount === 1000) {
|
|
63664
63732
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63665
63733
|
result = errorType;
|
|
@@ -63780,10 +63848,10 @@ var ts;
|
|
|
63780
63848
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63781
63849
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63782
63850
|
while (true) {
|
|
63783
|
-
var
|
|
63784
|
-
if (typeof
|
|
63785
|
-
return
|
|
63786
|
-
if (
|
|
63851
|
+
var state_6 = _loop_20();
|
|
63852
|
+
if (typeof state_6 === "object")
|
|
63853
|
+
return state_6.value;
|
|
63854
|
+
if (state_6 === "break")
|
|
63787
63855
|
break;
|
|
63788
63856
|
}
|
|
63789
63857
|
return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
|
|
@@ -66398,7 +66466,7 @@ var ts;
|
|
|
66398
66466
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
66399
66467
|
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
|
|
66400
66468
|
}
|
|
66401
|
-
var
|
|
66469
|
+
var _loop_21 = function (prop) {
|
|
66402
66470
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
66403
66471
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
66404
66472
|
if (reportErrors) {
|
|
@@ -66461,9 +66529,9 @@ var ts;
|
|
|
66461
66529
|
};
|
|
66462
66530
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
66463
66531
|
var prop = _b[_i];
|
|
66464
|
-
var
|
|
66465
|
-
if (typeof
|
|
66466
|
-
return
|
|
66532
|
+
var state_7 = _loop_21(prop);
|
|
66533
|
+
if (typeof state_7 === "object")
|
|
66534
|
+
return state_7.value;
|
|
66467
66535
|
}
|
|
66468
66536
|
return false;
|
|
66469
66537
|
}
|
|
@@ -67454,11 +67522,11 @@ var ts;
|
|
|
67454
67522
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
67455
67523
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
67456
67524
|
var matchingTypes = [];
|
|
67457
|
-
var
|
|
67525
|
+
var _loop_22 = function (combination) {
|
|
67458
67526
|
var hasMatch = false;
|
|
67459
67527
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
67460
67528
|
var type = _d[_c];
|
|
67461
|
-
var
|
|
67529
|
+
var _loop_23 = function (i) {
|
|
67462
67530
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
67463
67531
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
67464
67532
|
if (!targetProperty)
|
|
@@ -67474,8 +67542,8 @@ var ts;
|
|
|
67474
67542
|
}
|
|
67475
67543
|
};
|
|
67476
67544
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
67477
|
-
var
|
|
67478
|
-
switch (
|
|
67545
|
+
var state_9 = _loop_23(i);
|
|
67546
|
+
switch (state_9) {
|
|
67479
67547
|
case "continue-outer": continue outer;
|
|
67480
67548
|
}
|
|
67481
67549
|
}
|
|
@@ -67488,9 +67556,9 @@ var ts;
|
|
|
67488
67556
|
};
|
|
67489
67557
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
67490
67558
|
var combination = discriminantCombinations_1[_a];
|
|
67491
|
-
var
|
|
67492
|
-
if (typeof
|
|
67493
|
-
return
|
|
67559
|
+
var state_8 = _loop_22(combination);
|
|
67560
|
+
if (typeof state_8 === "object")
|
|
67561
|
+
return state_8.value;
|
|
67494
67562
|
}
|
|
67495
67563
|
// Compare the remaining non-discriminant properties of each match.
|
|
67496
67564
|
var result = -1 /* Ternary.True */;
|
|
@@ -68195,7 +68263,7 @@ var ts;
|
|
|
68195
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)) });
|
|
68196
68264
|
links.variances = ts.emptyArray;
|
|
68197
68265
|
var variances = [];
|
|
68198
|
-
var
|
|
68266
|
+
var _loop_24 = function (tp) {
|
|
68199
68267
|
var modifiers = getVarianceModifiers(tp);
|
|
68200
68268
|
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
|
|
68201
68269
|
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
|
|
@@ -68233,7 +68301,7 @@ var ts;
|
|
|
68233
68301
|
};
|
|
68234
68302
|
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
68235
68303
|
var tp = typeParameters_2[_i];
|
|
68236
|
-
|
|
68304
|
+
_loop_24(tp);
|
|
68237
68305
|
}
|
|
68238
68306
|
links.variances = variances;
|
|
68239
68307
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68825,7 +68893,8 @@ var ts;
|
|
|
68825
68893
|
function getOptionalType(type, isProperty) {
|
|
68826
68894
|
if (isProperty === void 0) { isProperty = false; }
|
|
68827
68895
|
ts.Debug.assert(strictNullChecks);
|
|
68828
|
-
|
|
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]);
|
|
68829
68898
|
}
|
|
68830
68899
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
68831
68900
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
@@ -70190,7 +70259,7 @@ var ts;
|
|
|
70190
70259
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
70191
70260
|
// succeed. That would be a pointless and confusing outcome.
|
|
70192
70261
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
70193
|
-
var
|
|
70262
|
+
var _loop_25 = function (i) {
|
|
70194
70263
|
var source_1 = matches ? matches[i] : neverType;
|
|
70195
70264
|
var target_3 = types[i];
|
|
70196
70265
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -70240,7 +70309,7 @@ var ts;
|
|
|
70240
70309
|
inferFromTypes(source_1, target_3);
|
|
70241
70310
|
};
|
|
70242
70311
|
for (var i = 0; i < types.length; i++) {
|
|
70243
|
-
|
|
70312
|
+
_loop_25(i);
|
|
70244
70313
|
}
|
|
70245
70314
|
}
|
|
70246
70315
|
}
|
|
@@ -70704,7 +70773,7 @@ var ts;
|
|
|
70704
70773
|
return name;
|
|
70705
70774
|
}
|
|
70706
70775
|
}
|
|
70707
|
-
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
70776
|
+
if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
|
|
70708
70777
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
70709
70778
|
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
70710
70779
|
}
|
|
@@ -70764,7 +70833,7 @@ var ts;
|
|
|
70764
70833
|
function mapTypesByKeyProperty(types, name) {
|
|
70765
70834
|
var map = new ts.Map();
|
|
70766
70835
|
var count = 0;
|
|
70767
|
-
var
|
|
70836
|
+
var _loop_26 = function (type) {
|
|
70768
70837
|
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
|
|
70769
70838
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70770
70839
|
if (discriminant) {
|
|
@@ -70790,9 +70859,9 @@ var ts;
|
|
|
70790
70859
|
};
|
|
70791
70860
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70792
70861
|
var type = types_15[_i];
|
|
70793
|
-
var
|
|
70794
|
-
if (typeof
|
|
70795
|
-
return
|
|
70862
|
+
var state_10 = _loop_26(type);
|
|
70863
|
+
if (typeof state_10 === "object")
|
|
70864
|
+
return state_10.value;
|
|
70796
70865
|
}
|
|
70797
70866
|
return count >= 10 && count * 2 >= types.length ? map : undefined;
|
|
70798
70867
|
}
|
|
@@ -72191,18 +72260,26 @@ var ts;
|
|
|
72191
72260
|
}
|
|
72192
72261
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
72193
72262
|
var prop = getPropertyOfType(type, propName);
|
|
72194
|
-
|
|
72195
|
-
|
|
72196
|
-
|
|
72197
|
-
|
|
72198
|
-
|
|
72199
|
-
|
|
72200
|
-
|
|
72201
|
-
|
|
72202
|
-
|
|
72203
|
-
|
|
72263
|
+
return prop ?
|
|
72264
|
+
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
72265
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
72266
|
+
}
|
|
72267
|
+
function narrowByInKeyword(type, nameType, assumeTrue) {
|
|
72268
|
+
var name = getPropertyNameFromType(nameType);
|
|
72269
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
72270
|
+
if (isKnownProperty) {
|
|
72271
|
+
// If the check is for a known property (i.e. a property declared in some constituent of
|
|
72272
|
+
// the target type), we filter the target type by presence of absence of the property.
|
|
72204
72273
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
72205
72274
|
}
|
|
72275
|
+
if (assumeTrue) {
|
|
72276
|
+
// If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
|
|
72277
|
+
// where X is the name of the property.
|
|
72278
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
72279
|
+
if (recordSymbol) {
|
|
72280
|
+
return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]);
|
|
72281
|
+
}
|
|
72282
|
+
}
|
|
72206
72283
|
return type;
|
|
72207
72284
|
}
|
|
72208
72285
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -72261,15 +72338,14 @@ var ts;
|
|
|
72261
72338
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
72262
72339
|
}
|
|
72263
72340
|
var target = getReferenceCandidate(expr.right);
|
|
72264
|
-
var leftType =
|
|
72265
|
-
if (leftType.flags &
|
|
72266
|
-
var name = ts.escapeLeadingUnderscores(leftType.value);
|
|
72341
|
+
var leftType = getTypeOfExpression(expr.left);
|
|
72342
|
+
if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) {
|
|
72267
72343
|
if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
|
|
72268
|
-
getAccessedPropertyName(reference) ===
|
|
72344
|
+
getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
72269
72345
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
|
|
72270
72346
|
}
|
|
72271
72347
|
if (isMatchingReference(reference, target)) {
|
|
72272
|
-
return narrowByInKeyword(type,
|
|
72348
|
+
return narrowByInKeyword(type, leftType, assumeTrue);
|
|
72273
72349
|
}
|
|
72274
72350
|
}
|
|
72275
72351
|
break;
|
|
@@ -76439,7 +76515,6 @@ var ts;
|
|
|
76439
76515
|
}
|
|
76440
76516
|
return false;
|
|
76441
76517
|
}
|
|
76442
|
-
;
|
|
76443
76518
|
var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
|
|
76444
76519
|
if (!hasProp(suggestedMethod)) {
|
|
76445
76520
|
return undefined;
|
|
@@ -77241,7 +77316,7 @@ var ts;
|
|
|
77241
77316
|
if (spreadIndex >= 0) {
|
|
77242
77317
|
// Create synthetic arguments from spreads of tuple types.
|
|
77243
77318
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
77244
|
-
var
|
|
77319
|
+
var _loop_27 = function (i) {
|
|
77245
77320
|
var arg = args[i];
|
|
77246
77321
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
77247
77322
|
var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -77258,7 +77333,7 @@ var ts;
|
|
|
77258
77333
|
}
|
|
77259
77334
|
};
|
|
77260
77335
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
77261
|
-
|
|
77336
|
+
_loop_27(i);
|
|
77262
77337
|
}
|
|
77263
77338
|
return effectiveArgs_1;
|
|
77264
77339
|
}
|
|
@@ -77587,7 +77662,7 @@ var ts;
|
|
|
77587
77662
|
var min_3 = Number.MAX_VALUE;
|
|
77588
77663
|
var minIndex = 0;
|
|
77589
77664
|
var i_1 = 0;
|
|
77590
|
-
var
|
|
77665
|
+
var _loop_28 = function (c) {
|
|
77591
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)); };
|
|
77592
77667
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
|
|
77593
77668
|
if (diags_2) {
|
|
@@ -77605,7 +77680,7 @@ var ts;
|
|
|
77605
77680
|
};
|
|
77606
77681
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
77607
77682
|
var c = candidatesForArgumentError_1[_a];
|
|
77608
|
-
|
|
77683
|
+
_loop_28(c);
|
|
77609
77684
|
}
|
|
77610
77685
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
77611
77686
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77763,7 +77838,7 @@ var ts;
|
|
|
77763
77838
|
}
|
|
77764
77839
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77765
77840
|
var parameters = [];
|
|
77766
|
-
var
|
|
77841
|
+
var _loop_29 = function (i) {
|
|
77767
77842
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77768
77843
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77769
77844
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77771,7 +77846,7 @@ var ts;
|
|
|
77771
77846
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77772
77847
|
};
|
|
77773
77848
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77774
|
-
|
|
77849
|
+
_loop_29(i);
|
|
77775
77850
|
}
|
|
77776
77851
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77777
77852
|
var flags = 0 /* SignatureFlags.None */;
|
|
@@ -80010,6 +80085,9 @@ var ts;
|
|
|
80010
80085
|
}
|
|
80011
80086
|
return booleanType;
|
|
80012
80087
|
}
|
|
80088
|
+
function hasEmptyObjectIntersection(type) {
|
|
80089
|
+
return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); });
|
|
80090
|
+
}
|
|
80013
80091
|
function checkInExpression(left, right, leftType, rightType) {
|
|
80014
80092
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
80015
80093
|
return silentNeverType;
|
|
@@ -80026,40 +80104,20 @@ var ts;
|
|
|
80026
80104
|
}
|
|
80027
80105
|
}
|
|
80028
80106
|
else {
|
|
80029
|
-
|
|
80030
|
-
|
|
80031
|
-
|
|
80032
|
-
|
|
80033
|
-
|
|
80034
|
-
|
|
80107
|
+
// The type of the lef operand must be assignable to string, number, or symbol.
|
|
80108
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
80109
|
+
}
|
|
80110
|
+
// The type of the right operand must be assignable to 'object'.
|
|
80111
|
+
if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
|
|
80112
|
+
// The {} type is assignable to the object type, yet {} might represent a primitive type. Here we
|
|
80113
|
+
// detect and error on {} that results from narrowing the unknown type, as well as intersections
|
|
80114
|
+
// that include {} (we know that the other types in such intersections are assignable to object
|
|
80115
|
+
// since we already checked for that).
|
|
80116
|
+
if (hasEmptyObjectIntersection(rightType)) {
|
|
80117
|
+
error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType));
|
|
80035
80118
|
}
|
|
80036
80119
|
}
|
|
80037
|
-
rightType = checkNonNullType(rightType, right);
|
|
80038
|
-
// TypeScript 1.0 spec (April 2014): 4.15.5
|
|
80039
|
-
// The in operator requires the right operand to be
|
|
80040
|
-
//
|
|
80041
|
-
// 1. assignable to the non-primitive type,
|
|
80042
|
-
// 2. an unconstrained type parameter,
|
|
80043
|
-
// 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
|
|
80044
|
-
// the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
|
|
80045
|
-
// non-primitive type, or
|
|
80046
|
-
// 4. a type parameter whose constraint is
|
|
80047
|
-
// i. an object type,
|
|
80048
|
-
// ii. the non-primitive type, or
|
|
80049
|
-
// iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
|
|
80050
|
-
//
|
|
80051
|
-
// The divergent behavior for type parameters and unions containing type parameters is a workaround for type
|
|
80052
|
-
// parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
|
|
80053
|
-
// it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
|
|
80054
|
-
// unless *all* instantiations would result in an error.
|
|
80055
|
-
//
|
|
80056
80120
|
// The result is always of the Boolean primitive type.
|
|
80057
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
80058
|
-
if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
80059
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
80060
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
|
|
80061
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
80062
|
-
}
|
|
80063
80121
|
return booleanType;
|
|
80064
80122
|
}
|
|
80065
80123
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
|
@@ -80570,6 +80628,7 @@ var ts;
|
|
|
80570
80628
|
var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
|
|
80571
80629
|
error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
80572
80630
|
}
|
|
80631
|
+
checkNaNEquality(errorNode, operator, left, right);
|
|
80573
80632
|
reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
|
|
80574
80633
|
return booleanType;
|
|
80575
80634
|
case 102 /* SyntaxKind.InstanceOfKeyword */:
|
|
@@ -80775,6 +80834,26 @@ var ts;
|
|
|
80775
80834
|
return undefined;
|
|
80776
80835
|
}
|
|
80777
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
|
+
}
|
|
80778
80857
|
}
|
|
80779
80858
|
function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
|
|
80780
80859
|
var effectiveLeft = leftType;
|
|
@@ -81812,7 +81891,7 @@ var ts;
|
|
|
81812
81891
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81813
81892
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81814
81893
|
var indexSignatureMap_1 = new ts.Map();
|
|
81815
|
-
var
|
|
81894
|
+
var _loop_30 = function (declaration) {
|
|
81816
81895
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81817
81896
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81818
81897
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81827,7 +81906,7 @@ var ts;
|
|
|
81827
81906
|
};
|
|
81828
81907
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81829
81908
|
var declaration = _a[_i];
|
|
81830
|
-
|
|
81909
|
+
_loop_30(declaration);
|
|
81831
81910
|
}
|
|
81832
81911
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81833
81912
|
if (entry.declarations.length > 1) {
|
|
@@ -85427,7 +85506,7 @@ var ts;
|
|
|
85427
85506
|
var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
|
|
85428
85507
|
name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
|
|
85429
85508
|
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
85430
|
-
var
|
|
85509
|
+
var _loop_31 = function (info) {
|
|
85431
85510
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
85432
85511
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
85433
85512
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -85444,7 +85523,7 @@ var ts;
|
|
|
85444
85523
|
};
|
|
85445
85524
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
85446
85525
|
var info = indexInfos_9[_i];
|
|
85447
|
-
|
|
85526
|
+
_loop_31(info);
|
|
85448
85527
|
}
|
|
85449
85528
|
}
|
|
85450
85529
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -85452,7 +85531,7 @@ var ts;
|
|
|
85452
85531
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
85453
85532
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
|
|
85454
85533
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
85455
|
-
var
|
|
85534
|
+
var _loop_32 = function (info) {
|
|
85456
85535
|
if (info === checkInfo)
|
|
85457
85536
|
return "continue";
|
|
85458
85537
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -85467,7 +85546,7 @@ var ts;
|
|
|
85467
85546
|
};
|
|
85468
85547
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
85469
85548
|
var info = indexInfos_10[_i];
|
|
85470
|
-
|
|
85549
|
+
_loop_32(info);
|
|
85471
85550
|
}
|
|
85472
85551
|
}
|
|
85473
85552
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85787,7 +85866,7 @@ var ts;
|
|
|
85787
85866
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85788
85867
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85789
85868
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85790
|
-
var
|
|
85869
|
+
var _loop_33 = function (member) {
|
|
85791
85870
|
if (ts.hasAmbientModifier(member)) {
|
|
85792
85871
|
return "continue";
|
|
85793
85872
|
}
|
|
@@ -85804,7 +85883,7 @@ var ts;
|
|
|
85804
85883
|
};
|
|
85805
85884
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85806
85885
|
var member = _a[_i];
|
|
85807
|
-
|
|
85886
|
+
_loop_33(member);
|
|
85808
85887
|
}
|
|
85809
85888
|
}
|
|
85810
85889
|
/**
|
|
@@ -85892,7 +85971,7 @@ var ts;
|
|
|
85892
85971
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85893
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
|
|
85894
85973
|
var issuedMemberError = false;
|
|
85895
|
-
var
|
|
85974
|
+
var _loop_34 = function (member) {
|
|
85896
85975
|
if (ts.isStatic(member)) {
|
|
85897
85976
|
return "continue";
|
|
85898
85977
|
}
|
|
@@ -85911,7 +85990,7 @@ var ts;
|
|
|
85911
85990
|
};
|
|
85912
85991
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85913
85992
|
var member = _a[_i];
|
|
85914
|
-
|
|
85993
|
+
_loop_34(member);
|
|
85915
85994
|
}
|
|
85916
85995
|
if (!issuedMemberError) {
|
|
85917
85996
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85982,7 +86061,7 @@ var ts;
|
|
|
85982
86061
|
var _a, _b, _c, _d;
|
|
85983
86062
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85984
86063
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85985
|
-
var
|
|
86064
|
+
var _loop_35 = function (baseProperty) {
|
|
85986
86065
|
var base = getTargetSymbol(baseProperty);
|
|
85987
86066
|
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
|
|
85988
86067
|
return "continue";
|
|
@@ -86092,8 +86171,8 @@ var ts;
|
|
|
86092
86171
|
};
|
|
86093
86172
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
86094
86173
|
var baseProperty = baseProperties_1[_i];
|
|
86095
|
-
var
|
|
86096
|
-
switch (
|
|
86174
|
+
var state_11 = _loop_35(baseProperty);
|
|
86175
|
+
switch (state_11) {
|
|
86097
86176
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
86098
86177
|
}
|
|
86099
86178
|
}
|
|
@@ -88501,7 +88580,7 @@ var ts;
|
|
|
88501
88580
|
}
|
|
88502
88581
|
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
|
|
88503
88582
|
if (node) {
|
|
88504
|
-
var symbol =
|
|
88583
|
+
var symbol = getReferencedValueOrAliasSymbol(node);
|
|
88505
88584
|
// We should only get the declaration of an alias if there isn't a local value
|
|
88506
88585
|
// declaration for the symbol
|
|
88507
88586
|
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
@@ -88868,6 +88947,25 @@ var ts;
|
|
|
88868
88947
|
}
|
|
88869
88948
|
return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
|
|
88870
88949
|
}
|
|
88950
|
+
/**
|
|
88951
|
+
* Get either a value-meaning symbol or an alias symbol.
|
|
88952
|
+
* Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol,
|
|
88953
|
+
* we call `resolveName` to find a symbol.
|
|
88954
|
+
* This is because when caching the resolved symbol, we only consider value symbols, but here
|
|
88955
|
+
* we want to also get an alias symbol if one exists.
|
|
88956
|
+
*/
|
|
88957
|
+
function getReferencedValueOrAliasSymbol(reference) {
|
|
88958
|
+
var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
|
|
88959
|
+
if (resolvedSymbol && resolvedSymbol !== unknownSymbol) {
|
|
88960
|
+
return resolvedSymbol;
|
|
88961
|
+
}
|
|
88962
|
+
return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */,
|
|
88963
|
+
/*nodeNotFoundMessage*/ undefined,
|
|
88964
|
+
/*nameArg*/ undefined,
|
|
88965
|
+
/*isUse*/ true,
|
|
88966
|
+
/*excludeGlobals*/ undefined,
|
|
88967
|
+
/*getSpellingSuggestions*/ undefined);
|
|
88968
|
+
}
|
|
88871
88969
|
function getReferencedValueDeclaration(referenceIn) {
|
|
88872
88970
|
if (!ts.isGeneratedIdentifier(referenceIn)) {
|
|
88873
88971
|
var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier);
|
|
@@ -95317,9 +95415,10 @@ var ts;
|
|
|
95317
95415
|
return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
|
|
95318
95416
|
}
|
|
95319
95417
|
function shouldEmitAliasDeclaration(node) {
|
|
95320
|
-
return
|
|
95321
|
-
|
|
95322
|
-
|
|
95418
|
+
return ts.isInJSFile(node) ||
|
|
95419
|
+
(compilerOptions.preserveValueImports
|
|
95420
|
+
? resolver.isValueAliasDeclaration(node)
|
|
95421
|
+
: resolver.isReferencedAliasDeclaration(node));
|
|
95323
95422
|
}
|
|
95324
95423
|
}
|
|
95325
95424
|
ts.transformTypeScript = transformTypeScript;
|
|
@@ -110491,7 +110590,7 @@ var ts;
|
|
|
110491
110590
|
var _a;
|
|
110492
110591
|
var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
|
|
110493
110592
|
var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
|
|
110494
|
-
if (augmentingDeclarations) {
|
|
110593
|
+
if (primaryDeclaration && augmentingDeclarations) {
|
|
110495
110594
|
for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
|
|
110496
110595
|
var augmentations = augmentingDeclarations_1[_i];
|
|
110497
110596
|
context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file)));
|
|
@@ -118540,7 +118639,6 @@ var ts;
|
|
|
118540
118639
|
return resolutions;
|
|
118541
118640
|
}
|
|
118542
118641
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
118543
|
-
;
|
|
118544
118642
|
/**
|
|
118545
118643
|
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
118546
118644
|
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
@@ -124917,7 +125015,7 @@ var ts;
|
|
|
124917
125015
|
});
|
|
124918
125016
|
// Sort by paths closest to importing file Name directory
|
|
124919
125017
|
var sortedPaths = [];
|
|
124920
|
-
var
|
|
125018
|
+
var _loop_36 = function (directory) {
|
|
124921
125019
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
124922
125020
|
var pathsInDirectory;
|
|
124923
125021
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -124941,9 +125039,9 @@ var ts;
|
|
|
124941
125039
|
};
|
|
124942
125040
|
var out_directory_1;
|
|
124943
125041
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
124944
|
-
var
|
|
125042
|
+
var state_12 = _loop_36(directory);
|
|
124945
125043
|
directory = out_directory_1;
|
|
124946
|
-
if (
|
|
125044
|
+
if (state_12 === "break")
|
|
124947
125045
|
break;
|
|
124948
125046
|
}
|
|
124949
125047
|
if (allFileNames.size) {
|
|
@@ -125012,7 +125110,7 @@ var ts;
|
|
|
125012
125110
|
}
|
|
125013
125111
|
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
125014
125112
|
for (var key in paths) {
|
|
125015
|
-
var
|
|
125113
|
+
var _loop_37 = function (patternText_1) {
|
|
125016
125114
|
var pattern = ts.normalizePath(patternText_1);
|
|
125017
125115
|
var indexOfStar = pattern.indexOf("*");
|
|
125018
125116
|
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
|
|
@@ -125079,9 +125177,9 @@ var ts;
|
|
|
125079
125177
|
};
|
|
125080
125178
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
125081
125179
|
var patternText_1 = _a[_i];
|
|
125082
|
-
var
|
|
125083
|
-
if (typeof
|
|
125084
|
-
return
|
|
125180
|
+
var state_13 = _loop_37(patternText_1);
|
|
125181
|
+
if (typeof state_13 === "object")
|
|
125182
|
+
return state_13.value;
|
|
125085
125183
|
}
|
|
125086
125184
|
}
|
|
125087
125185
|
function validateEnding(_a) {
|
|
@@ -134617,7 +134715,7 @@ var ts;
|
|
|
134617
134715
|
if (!dependencies)
|
|
134618
134716
|
continue;
|
|
134619
134717
|
for (var dep in dependencies) {
|
|
134620
|
-
if (
|
|
134718
|
+
if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) {
|
|
134621
134719
|
result.push(dep);
|
|
134622
134720
|
}
|
|
134623
134721
|
}
|
|
@@ -135001,7 +135099,7 @@ var ts;
|
|
|
135001
135099
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
135002
135100
|
}
|
|
135003
135101
|
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
135004
|
-
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,
|
|
135102
|
+
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;
|
|
135005
135103
|
// Verify if the file is JSX language variant
|
|
135006
135104
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) {
|
|
135007
135105
|
var completionInfo = getJsxClosingTagCompletion(location, sourceFile);
|
|
@@ -135015,7 +135113,7 @@ var ts;
|
|
|
135015
135113
|
return undefined;
|
|
135016
135114
|
}
|
|
135017
135115
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
135018
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer,
|
|
135116
|
+
/*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);
|
|
135019
135117
|
if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) {
|
|
135020
135118
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
135021
135119
|
var keywordEntry = _a[_i];
|
|
@@ -135133,7 +135231,7 @@ var ts;
|
|
|
135133
135231
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
135134
135232
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority };
|
|
135135
135233
|
}
|
|
135136
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
135234
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
135137
135235
|
var _a, _b;
|
|
135138
135236
|
var insertText;
|
|
135139
135237
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
@@ -135189,8 +135287,8 @@ var ts;
|
|
|
135189
135287
|
}
|
|
135190
135288
|
if (originIsResolvedExport(origin)) {
|
|
135191
135289
|
sourceDisplay = [ts.textPart(origin.moduleSpecifier)];
|
|
135192
|
-
if (
|
|
135193
|
-
(_a = getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
135290
|
+
if (importStatementCompletion) {
|
|
135291
|
+
(_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
|
|
135194
135292
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
135195
135293
|
}
|
|
135196
135294
|
}
|
|
@@ -135245,7 +135343,7 @@ var ts;
|
|
|
135245
135343
|
}
|
|
135246
135344
|
if (originIsExport(origin) || originIsResolvedExport(origin)) {
|
|
135247
135345
|
data = originToCompletionEntryData(origin);
|
|
135248
|
-
hasAction = !
|
|
135346
|
+
hasAction = !importStatementCompletion;
|
|
135249
135347
|
}
|
|
135250
135348
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
135251
135349
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
@@ -135268,7 +135366,7 @@ var ts;
|
|
|
135268
135366
|
labelDetails: labelDetails,
|
|
135269
135367
|
isSnippet: isSnippet,
|
|
135270
135368
|
isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
|
|
135271
|
-
isImportStatementCompletion: !!
|
|
135369
|
+
isImportStatementCompletion: !!importStatementCompletion || undefined,
|
|
135272
135370
|
data: data,
|
|
135273
135371
|
};
|
|
135274
135372
|
}
|
|
@@ -135470,7 +135568,6 @@ var ts;
|
|
|
135470
135568
|
var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) };
|
|
135471
135569
|
return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
|
|
135472
135570
|
}
|
|
135473
|
-
;
|
|
135474
135571
|
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
|
|
135475
135572
|
var declarations = symbol.getDeclarations();
|
|
135476
135573
|
if (!(declarations && declarations.length)) {
|
|
@@ -135641,19 +135738,16 @@ var ts;
|
|
|
135641
135738
|
};
|
|
135642
135739
|
return unresolvedOrigin;
|
|
135643
135740
|
}
|
|
135644
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
135645
|
-
var
|
|
135646
|
-
var sourceFile = importCompletionNode.getSourceFile();
|
|
135647
|
-
var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile);
|
|
135741
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
135742
|
+
var replacementSpan = importStatementCompletion.replacementSpan;
|
|
135648
135743
|
var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
135649
135744
|
var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ :
|
|
135650
135745
|
origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ :
|
|
135651
135746
|
0 /* ExportKind.Named */;
|
|
135652
135747
|
var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
135653
135748
|
var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true);
|
|
135654
|
-
var
|
|
135655
|
-
var
|
|
135656
|
-
var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
135749
|
+
var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier;
|
|
135750
|
+
var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
135657
135751
|
var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : "";
|
|
135658
135752
|
var suffix = useSemicolons ? ";" : "";
|
|
135659
135753
|
switch (importKind) {
|
|
@@ -135687,7 +135781,7 @@ var ts;
|
|
|
135687
135781
|
return CompletionSource.TypeOnlyAlias;
|
|
135688
135782
|
}
|
|
135689
135783
|
}
|
|
135690
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer,
|
|
135784
|
+
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) {
|
|
135691
135785
|
var _a;
|
|
135692
135786
|
var start = ts.timestamp();
|
|
135693
135787
|
var variableDeclaration = getVariableDeclaration(location);
|
|
@@ -135708,7 +135802,7 @@ var ts;
|
|
|
135708
135802
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
135709
135803
|
var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority;
|
|
135710
135804
|
var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText);
|
|
135711
|
-
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
135805
|
+
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);
|
|
135712
135806
|
if (!entry) {
|
|
135713
135807
|
continue;
|
|
135714
135808
|
}
|
|
@@ -135899,7 +135993,7 @@ var ts;
|
|
|
135899
135993
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
135900
135994
|
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
|
|
135901
135995
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
135902
|
-
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).
|
|
135996
|
+
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
|
|
135903
135997
|
// Import statement completion: 'import c|'
|
|
135904
135998
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
135905
135999
|
}
|
|
@@ -136100,34 +136194,34 @@ var ts;
|
|
|
136100
136194
|
var isStartingCloseTag = false;
|
|
136101
136195
|
var isJsxInitializer = false;
|
|
136102
136196
|
var isJsxIdentifierExpected = false;
|
|
136103
|
-
var
|
|
136197
|
+
var importStatementCompletion;
|
|
136104
136198
|
var location = ts.getTouchingPropertyName(sourceFile, position);
|
|
136105
136199
|
var keywordFilters = 0 /* KeywordCompletionFilters.None */;
|
|
136106
136200
|
var isNewIdentifierLocation = false;
|
|
136107
136201
|
var flags = 0 /* CompletionInfoFlags.None */;
|
|
136108
136202
|
if (contextToken) {
|
|
136109
|
-
var
|
|
136110
|
-
|
|
136111
|
-
|
|
136112
|
-
if (importStatementCompletion.isKeywordOnlyCompletion) {
|
|
136203
|
+
var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
|
|
136204
|
+
if (importStatementCompletionInfo.keywordCompletion) {
|
|
136205
|
+
if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
|
|
136113
136206
|
return {
|
|
136114
136207
|
kind: 4 /* CompletionDataKind.Keywords */,
|
|
136115
|
-
keywordCompletions: [keywordToCompletionEntry(
|
|
136116
|
-
isNewIdentifierLocation: isNewIdentifierLocation,
|
|
136208
|
+
keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)],
|
|
136209
|
+
isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation,
|
|
136117
136210
|
};
|
|
136118
136211
|
}
|
|
136119
|
-
keywordFilters = keywordFiltersFromSyntaxKind(
|
|
136212
|
+
keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion);
|
|
136120
136213
|
}
|
|
136121
|
-
if (
|
|
136214
|
+
if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
|
|
136122
136215
|
// Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
|
|
136123
136216
|
// added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
|
|
136124
136217
|
// is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
|
|
136125
136218
|
// to opt in with the `includeCompletionsForImportStatements` user preference.
|
|
136126
|
-
importCompletionNode = importStatementCompletion.replacementNode;
|
|
136127
136219
|
flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */;
|
|
136220
|
+
importStatementCompletion = importStatementCompletionInfo;
|
|
136221
|
+
isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
|
|
136128
136222
|
}
|
|
136129
136223
|
// Bail out if this is a known invalid completion location
|
|
136130
|
-
if (!
|
|
136224
|
+
if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
|
|
136131
136225
|
log("Returning an empty list because completion was requested in an invalid position.");
|
|
136132
136226
|
return keywordFilters
|
|
136133
136227
|
? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation())
|
|
@@ -136173,7 +136267,7 @@ var ts;
|
|
|
136173
136267
|
return undefined;
|
|
136174
136268
|
}
|
|
136175
136269
|
}
|
|
136176
|
-
else if (!
|
|
136270
|
+
else if (!importStatementCompletion) {
|
|
136177
136271
|
// <UI.Test /* completion position */ />
|
|
136178
136272
|
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
|
|
136179
136273
|
// Then, try to get a JSX container and its associated attributes type.
|
|
@@ -136316,7 +136410,7 @@ var ts;
|
|
|
136316
136410
|
isTypeOnlyLocation: isTypeOnlyLocation,
|
|
136317
136411
|
isJsxIdentifierExpected: isJsxIdentifierExpected,
|
|
136318
136412
|
isRightOfOpenTag: isRightOfOpenTag,
|
|
136319
|
-
|
|
136413
|
+
importStatementCompletion: importStatementCompletion,
|
|
136320
136414
|
hasUnresolvedAutoImports: hasUnresolvedAutoImports,
|
|
136321
136415
|
flags: flags,
|
|
136322
136416
|
};
|
|
@@ -136570,7 +136664,7 @@ var ts;
|
|
|
136570
136664
|
return 1 /* GlobalsSearch.Success */;
|
|
136571
136665
|
}
|
|
136572
136666
|
function tryGetImportCompletionSymbols() {
|
|
136573
|
-
if (!
|
|
136667
|
+
if (!importStatementCompletion)
|
|
136574
136668
|
return 0 /* GlobalsSearch.Continue */;
|
|
136575
136669
|
isNewIdentifierLocation = true;
|
|
136576
136670
|
collectAutoImports();
|
|
@@ -136653,7 +136747,7 @@ var ts;
|
|
|
136653
136747
|
}
|
|
136654
136748
|
function shouldOfferImportCompletions() {
|
|
136655
136749
|
// If already typing an import statement, provide completions for it.
|
|
136656
|
-
if (
|
|
136750
|
+
if (importStatementCompletion)
|
|
136657
136751
|
return true;
|
|
136658
136752
|
// If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
|
|
136659
136753
|
if (isNonContextualObjectLiteral)
|
|
@@ -136683,7 +136777,7 @@ var ts;
|
|
|
136683
136777
|
}
|
|
136684
136778
|
function isTypeOnlyCompletion() {
|
|
136685
136779
|
return insideJsDocTagTypeExpression
|
|
136686
|
-
|| !!
|
|
136780
|
+
|| !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
|
|
136687
136781
|
|| !isContextTokenValueLocation(contextToken) &&
|
|
136688
136782
|
(ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
|
|
136689
136783
|
|| ts.isPartOfTypeNode(location)
|
|
@@ -136733,8 +136827,7 @@ var ts;
|
|
|
136733
136827
|
flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */;
|
|
136734
136828
|
// import { type | -> token text should be blank
|
|
136735
136829
|
var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
|
|
136736
|
-
&&
|
|
136737
|
-
&& couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
|
|
136830
|
+
&& importStatementCompletion;
|
|
136738
136831
|
var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" :
|
|
136739
136832
|
previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() :
|
|
136740
136833
|
"";
|
|
@@ -136742,14 +136835,14 @@ var ts;
|
|
|
136742
136835
|
var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken);
|
|
136743
136836
|
var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
136744
136837
|
var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
136745
|
-
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!
|
|
136838
|
+
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
136746
136839
|
exportInfo.search(sourceFile.path,
|
|
136747
136840
|
/*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
|
|
136748
136841
|
if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
|
|
136749
136842
|
return false;
|
|
136750
136843
|
if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
|
|
136751
136844
|
return false;
|
|
136752
|
-
if (!isTypeOnlyLocation && !
|
|
136845
|
+
if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */))
|
|
136753
136846
|
return false;
|
|
136754
136847
|
if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */)))
|
|
136755
136848
|
return false;
|
|
@@ -136830,7 +136923,7 @@ var ts;
|
|
|
136830
136923
|
return;
|
|
136831
136924
|
}
|
|
136832
136925
|
symbolToOriginInfoMap[symbols.length] = origin;
|
|
136833
|
-
symbolToSortTextMap[symbolId] =
|
|
136926
|
+
symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
|
|
136834
136927
|
symbols.push(symbol);
|
|
136835
136928
|
}
|
|
136836
136929
|
/* Mutates `symbols` and `symbolToOriginInfoMap`. */
|
|
@@ -138097,6 +138190,7 @@ var ts;
|
|
|
138097
138190
|
return undefined;
|
|
138098
138191
|
}
|
|
138099
138192
|
function getImportStatementCompletionInfo(contextToken) {
|
|
138193
|
+
var _a, _b, _c;
|
|
138100
138194
|
var keywordCompletion;
|
|
138101
138195
|
var isKeywordOnlyCompletion = false;
|
|
138102
138196
|
var candidate = getCandidate();
|
|
@@ -138104,9 +138198,9 @@ var ts;
|
|
|
138104
138198
|
isKeywordOnlyCompletion: isKeywordOnlyCompletion,
|
|
138105
138199
|
keywordCompletion: keywordCompletion,
|
|
138106
138200
|
isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */),
|
|
138107
|
-
|
|
138108
|
-
|
|
138109
|
-
|
|
138201
|
+
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),
|
|
138202
|
+
couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken),
|
|
138203
|
+
replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate),
|
|
138110
138204
|
};
|
|
138111
138205
|
function getCandidate() {
|
|
138112
138206
|
var parent = contextToken.parent;
|
|
@@ -138148,14 +138242,71 @@ var ts;
|
|
|
138148
138242
|
return undefined;
|
|
138149
138243
|
}
|
|
138150
138244
|
}
|
|
138245
|
+
function getSingleLineReplacementSpanForImportCompletionNode(node) {
|
|
138246
|
+
var _a, _b, _c;
|
|
138247
|
+
if (!node)
|
|
138248
|
+
return undefined;
|
|
138249
|
+
var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node;
|
|
138250
|
+
var sourceFile = top.getSourceFile();
|
|
138251
|
+
if (ts.rangeIsOnSingleLine(top, sourceFile)) {
|
|
138252
|
+
return ts.createTextSpanFromNode(top, sourceFile);
|
|
138253
|
+
}
|
|
138254
|
+
// ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration
|
|
138255
|
+
ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */);
|
|
138256
|
+
// Guess which point in the import might actually be a later statement parsed as part of the import
|
|
138257
|
+
// during parser recovery - either in the middle of named imports, or the module specifier.
|
|
138258
|
+
var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */
|
|
138259
|
+
? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier
|
|
138260
|
+
: top.moduleReference;
|
|
138261
|
+
var withoutModuleSpecifier = {
|
|
138262
|
+
pos: top.getFirstToken().getStart(),
|
|
138263
|
+
end: potentialSplitPoint.pos,
|
|
138264
|
+
};
|
|
138265
|
+
// The module specifier/reference was previously found to be missing, empty, or
|
|
138266
|
+
// not a string literal - in this last case, it's likely that statement on a following
|
|
138267
|
+
// line was parsed as the module specifier of a partially-typed import, e.g.
|
|
138268
|
+
// import Foo|
|
|
138269
|
+
// interface Blah {}
|
|
138270
|
+
// This appears to be a multiline-import, and editors can't replace multiple lines.
|
|
138271
|
+
// But if everything but the "module specifier" is on one line, by this point we can
|
|
138272
|
+
// assume that the "module specifier" is actually just another statement, and return
|
|
138273
|
+
// the single-line range of the import excluding that probable statement.
|
|
138274
|
+
if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) {
|
|
138275
|
+
return ts.createTextSpanFromRange(withoutModuleSpecifier);
|
|
138276
|
+
}
|
|
138277
|
+
}
|
|
138278
|
+
// Tries to identify the first named import that is not really a named import, but rather
|
|
138279
|
+
// just parser recovery for a situation like:
|
|
138280
|
+
// import { Foo|
|
|
138281
|
+
// interface Bar {}
|
|
138282
|
+
// in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller
|
|
138283
|
+
// will also check if this token is on a separate line from the rest of the import.
|
|
138284
|
+
function getPotentiallyInvalidImportSpecifier(namedBindings) {
|
|
138285
|
+
var _a;
|
|
138286
|
+
return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) {
|
|
138287
|
+
var _a;
|
|
138288
|
+
return !e.propertyName &&
|
|
138289
|
+
ts.isStringANonContextualKeyword(e.name.text) &&
|
|
138290
|
+
((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */;
|
|
138291
|
+
});
|
|
138292
|
+
}
|
|
138151
138293
|
function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) {
|
|
138152
138294
|
return ts.isImportSpecifier(importSpecifier)
|
|
138153
138295
|
&& (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken));
|
|
138154
138296
|
}
|
|
138155
138297
|
function canCompleteFromNamedBindings(namedBindings) {
|
|
138156
|
-
|
|
138157
|
-
|
|
138158
|
-
|
|
138298
|
+
if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) {
|
|
138299
|
+
return false;
|
|
138300
|
+
}
|
|
138301
|
+
if (ts.isNamedImports(namedBindings)) {
|
|
138302
|
+
// We can only complete on named imports if there are no other named imports already,
|
|
138303
|
+
// but parser recovery sometimes puts later statements in the named imports list, so
|
|
138304
|
+
// we try to only consider the probably-valid ones.
|
|
138305
|
+
var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings);
|
|
138306
|
+
var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length;
|
|
138307
|
+
return validImports < 2;
|
|
138308
|
+
}
|
|
138309
|
+
return true;
|
|
138159
138310
|
}
|
|
138160
138311
|
function isModuleSpecifierMissingOrEmpty(specifier) {
|
|
138161
138312
|
var _a;
|
|
@@ -138174,7 +138325,6 @@ var ts;
|
|
|
138174
138325
|
function isArrowFunctionBody(node) {
|
|
138175
138326
|
return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node;
|
|
138176
138327
|
}
|
|
138177
|
-
;
|
|
138178
138328
|
/** True if symbol is a type or a module containing at least one type. */
|
|
138179
138329
|
function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
|
|
138180
138330
|
if (seenModules === void 0) { seenModules = new ts.Map(); }
|
|
@@ -149255,19 +149405,19 @@ var ts;
|
|
|
149255
149405
|
return function (context) { return context.options && context.options[optionName] === optionValue; };
|
|
149256
149406
|
}
|
|
149257
149407
|
function isOptionEnabled(optionName) {
|
|
149258
|
-
return function (context) { return context.options && context.options
|
|
149408
|
+
return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; };
|
|
149259
149409
|
}
|
|
149260
149410
|
function isOptionDisabled(optionName) {
|
|
149261
|
-
return function (context) { return context.options && context.options
|
|
149411
|
+
return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; };
|
|
149262
149412
|
}
|
|
149263
149413
|
function isOptionDisabledOrUndefined(optionName) {
|
|
149264
|
-
return function (context) { return !context.options || !context.options
|
|
149414
|
+
return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; };
|
|
149265
149415
|
}
|
|
149266
149416
|
function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) {
|
|
149267
|
-
return function (context) { return !context.options || !context.options
|
|
149417
|
+
return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
|
|
149268
149418
|
}
|
|
149269
149419
|
function isOptionEnabledOrUndefined(optionName) {
|
|
149270
|
-
return function (context) { return !context.options || !context.options
|
|
149420
|
+
return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; };
|
|
149271
149421
|
}
|
|
149272
149422
|
function isForContext(context) {
|
|
149273
149423
|
return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */;
|
|
@@ -156889,7 +157039,7 @@ var ts;
|
|
|
156889
157039
|
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
|
|
156890
157040
|
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
156891
157041
|
return;
|
|
156892
|
-
var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157042
|
+
var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
156893
157043
|
if (declaration === undefined)
|
|
156894
157044
|
return;
|
|
156895
157045
|
if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) {
|
|
@@ -156923,14 +157073,6 @@ var ts;
|
|
|
156923
157073
|
}
|
|
156924
157074
|
}
|
|
156925
157075
|
}
|
|
156926
|
-
function findAncestorMatchingSpan(sourceFile, span) {
|
|
156927
|
-
var end = ts.textSpanEnd(span);
|
|
156928
|
-
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
156929
|
-
while (token.end < end) {
|
|
156930
|
-
token = token.parent;
|
|
156931
|
-
}
|
|
156932
|
-
return token;
|
|
156933
|
-
}
|
|
156934
157076
|
function tryGetConstraintFromDiagnosticMessage(messageText) {
|
|
156935
157077
|
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1];
|
|
156936
157078
|
return constraint;
|
|
@@ -158476,6 +158618,63 @@ var ts;
|
|
|
158476
158618
|
})(ts || (ts = {}));
|
|
158477
158619
|
/* @internal */
|
|
158478
158620
|
var ts;
|
|
158621
|
+
(function (ts) {
|
|
158622
|
+
var codefix;
|
|
158623
|
+
(function (codefix) {
|
|
158624
|
+
var fixId = "fixNaNEquality";
|
|
158625
|
+
var errorCodes = [
|
|
158626
|
+
ts.Diagnostics.This_condition_will_always_return_0.code,
|
|
158627
|
+
];
|
|
158628
|
+
codefix.registerCodeFix({
|
|
158629
|
+
errorCodes: errorCodes,
|
|
158630
|
+
getCodeActions: function (context) {
|
|
158631
|
+
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
158632
|
+
var info = getInfo(program, sourceFile, span);
|
|
158633
|
+
if (info === undefined)
|
|
158634
|
+
return;
|
|
158635
|
+
var suggestion = info.suggestion, expression = info.expression, arg = info.arg;
|
|
158636
|
+
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); });
|
|
158637
|
+
return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
158638
|
+
},
|
|
158639
|
+
fixIds: [fixId],
|
|
158640
|
+
getAllCodeActions: function (context) {
|
|
158641
|
+
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
158642
|
+
var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length));
|
|
158643
|
+
if (info) {
|
|
158644
|
+
doChange(changes, diag.file, info.arg, info.expression);
|
|
158645
|
+
}
|
|
158646
|
+
});
|
|
158647
|
+
}
|
|
158648
|
+
});
|
|
158649
|
+
function getInfo(program, sourceFile, span) {
|
|
158650
|
+
var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
|
|
158651
|
+
if (diag === undefined || diag.relatedInformation === undefined)
|
|
158652
|
+
return;
|
|
158653
|
+
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; });
|
|
158654
|
+
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
158655
|
+
return;
|
|
158656
|
+
var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
158657
|
+
if (token === undefined)
|
|
158658
|
+
return;
|
|
158659
|
+
if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) {
|
|
158660
|
+
return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token };
|
|
158661
|
+
}
|
|
158662
|
+
return undefined;
|
|
158663
|
+
}
|
|
158664
|
+
function doChange(changes, sourceFile, arg, expression) {
|
|
158665
|
+
var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]);
|
|
158666
|
+
var operator = expression.operatorToken.kind;
|
|
158667
|
+
changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */
|
|
158668
|
+
? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression);
|
|
158669
|
+
}
|
|
158670
|
+
function getSuggestion(messageText) {
|
|
158671
|
+
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1];
|
|
158672
|
+
return suggestion;
|
|
158673
|
+
}
|
|
158674
|
+
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
158675
|
+
})(ts || (ts = {}));
|
|
158676
|
+
/* @internal */
|
|
158677
|
+
var ts;
|
|
158479
158678
|
(function (ts) {
|
|
158480
158679
|
var codefix;
|
|
158481
158680
|
(function (codefix) {
|
|
@@ -161193,6 +161392,15 @@ var ts;
|
|
|
161193
161392
|
symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); });
|
|
161194
161393
|
}
|
|
161195
161394
|
codefix.importSymbols = importSymbols;
|
|
161395
|
+
function findAncestorMatchingSpan(sourceFile, span) {
|
|
161396
|
+
var end = ts.textSpanEnd(span);
|
|
161397
|
+
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
161398
|
+
while (token.end < end) {
|
|
161399
|
+
token = token.parent;
|
|
161400
|
+
}
|
|
161401
|
+
return token;
|
|
161402
|
+
}
|
|
161403
|
+
codefix.findAncestorMatchingSpan = findAncestorMatchingSpan;
|
|
161196
161404
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
161197
161405
|
})(ts || (ts = {}));
|
|
161198
161406
|
/* @internal */
|
|
@@ -162251,7 +162459,6 @@ var ts;
|
|
|
162251
162459
|
return { edits: edits, renameFilename: undefined, renameLocation: undefined };
|
|
162252
162460
|
},
|
|
162253
162461
|
});
|
|
162254
|
-
;
|
|
162255
162462
|
function getInfo(context, considerPartialSpans) {
|
|
162256
162463
|
if (considerPartialSpans === void 0) { considerPartialSpans = true; }
|
|
162257
162464
|
var file = context.file, program = context.program;
|
|
@@ -162728,7 +162935,6 @@ var ts;
|
|
|
162728
162935
|
});
|
|
162729
162936
|
return { edits: edits, renameFilename: undefined, renameLocation: undefined };
|
|
162730
162937
|
}
|
|
162731
|
-
;
|
|
162732
162938
|
function isValidExpression(node) {
|
|
162733
162939
|
return ts.isBinaryExpression(node) || ts.isConditionalExpression(node);
|
|
162734
162940
|
}
|
|
@@ -162776,7 +162982,6 @@ var ts;
|
|
|
162776
162982
|
if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) {
|
|
162777
162983
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) };
|
|
162778
162984
|
}
|
|
162779
|
-
;
|
|
162780
162985
|
var finalExpression = getFinalExpressionInChain(expression.right);
|
|
162781
162986
|
if (!finalExpression)
|
|
162782
162987
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) };
|
|
@@ -165120,7 +165325,6 @@ var ts;
|
|
|
165120
165325
|
(function (ts) {
|
|
165121
165326
|
var refactor;
|
|
165122
165327
|
(function (refactor) {
|
|
165123
|
-
;
|
|
165124
165328
|
/**
|
|
165125
165329
|
* Checks if some refactor info has refactor error info.
|
|
165126
165330
|
*/
|
|
@@ -165225,7 +165429,6 @@ var ts;
|
|
|
165225
165429
|
// Imports will be copied to the new file anyway, and may still be needed in the old file.
|
|
165226
165430
|
// Prologue directives will be copied to the new file and should be left in the old file.
|
|
165227
165431
|
return !isPureImport(statement) && !ts.isPrologueDirective(statement);
|
|
165228
|
-
;
|
|
165229
165432
|
}
|
|
165230
165433
|
function isPureImport(node) {
|
|
165231
165434
|
switch (node.kind) {
|
|
@@ -175280,7 +175483,7 @@ var ts;
|
|
|
175280
175483
|
// raw is now fixed and ready
|
|
175281
175484
|
this.safelist = raw.typesMap;
|
|
175282
175485
|
for (var key in raw.simpleMap) {
|
|
175283
|
-
if (raw.simpleMap
|
|
175486
|
+
if (ts.hasProperty(raw.simpleMap, key)) {
|
|
175284
175487
|
this.legacySafelist.set(key, raw.simpleMap[key].toLowerCase());
|
|
175285
175488
|
}
|
|
175286
175489
|
}
|
|
@@ -178694,7 +178897,6 @@ var ts;
|
|
|
178694
178897
|
}
|
|
178695
178898
|
return ts.deduplicate(outputs, ts.equateValues);
|
|
178696
178899
|
}
|
|
178697
|
-
;
|
|
178698
178900
|
function createDocumentSpanSet() {
|
|
178699
178901
|
return ts.createSet(function (_a) {
|
|
178700
178902
|
var textSpan = _a.textSpan;
|