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
|
@@ -99,7 +99,7 @@ var ts;
|
|
|
99
99
|
// The following is baselined as a literal template type without intervention
|
|
100
100
|
/** The version of the TypeScript compiler release */
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
102
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
102
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220921");
|
|
103
103
|
/* @internal */
|
|
104
104
|
var Comparison;
|
|
105
105
|
(function (Comparison) {
|
|
@@ -2683,7 +2683,7 @@ var ts;
|
|
|
2683
2683
|
if (typeof func !== "function") {
|
|
2684
2684
|
return "";
|
|
2685
2685
|
}
|
|
2686
|
-
else if (
|
|
2686
|
+
else if (ts.hasProperty(func, "name")) {
|
|
2687
2687
|
return func.name;
|
|
2688
2688
|
}
|
|
2689
2689
|
else {
|
|
@@ -3008,7 +3008,7 @@ var ts;
|
|
|
3008
3008
|
];
|
|
3009
3009
|
for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
|
|
3010
3010
|
var ctor = nodeConstructors_1[_i];
|
|
3011
|
-
if (!ctor.prototype
|
|
3011
|
+
if (!ts.hasProperty(ctor.prototype, "__debugKind")) {
|
|
3012
3012
|
Object.defineProperties(ctor.prototype, {
|
|
3013
3013
|
// for use with vscode-js-debug's new customDescriptionGenerator in launch.json
|
|
3014
3014
|
__tsDebuggerDisplay: {
|
|
@@ -3863,7 +3863,6 @@ var ts;
|
|
|
3863
3863
|
var typeCatalog = []; // NB: id is index + 1
|
|
3864
3864
|
var legendPath;
|
|
3865
3865
|
var legend = [];
|
|
3866
|
-
;
|
|
3867
3866
|
/** Starts tracing for the given project. */
|
|
3868
3867
|
function startTracing(tracingMode, traceDir, configFilePath) {
|
|
3869
3868
|
ts.Debug.assert(!ts.tracing, "Tracing already started");
|
|
@@ -8695,8 +8694,6 @@ var ts;
|
|
|
8695
8694
|
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."),
|
|
8696
8695
|
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."),
|
|
8697
8696
|
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."),
|
|
8698
|
-
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'."),
|
|
8699
|
-
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."),
|
|
8700
8697
|
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."),
|
|
8701
8698
|
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."),
|
|
8702
8699
|
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."),
|
|
@@ -8945,6 +8942,7 @@ var ts;
|
|
|
8945
8942
|
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."),
|
|
8946
8943
|
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."),
|
|
8947
8944
|
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."),
|
|
8945
|
+
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."),
|
|
8948
8946
|
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."),
|
|
8949
8947
|
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."),
|
|
8950
8948
|
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."),
|
|
@@ -9125,6 +9123,7 @@ var ts;
|
|
|
9125
9123
|
_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
|
|
9126
9124
|
We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
|
|
9127
9125
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
9126
|
+
This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
9128
9127
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
9129
9128
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
9130
9129
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -10067,6 +10066,8 @@ var ts;
|
|
|
10067
10066
|
Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
|
|
10068
10067
|
Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
|
|
10069
10068
|
Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
|
|
10069
|
+
Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."),
|
|
10070
|
+
Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
10070
10071
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
10071
10072
|
Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
10072
10073
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -10328,7 +10329,7 @@ var ts;
|
|
|
10328
10329
|
ts.stringToToken = stringToToken;
|
|
10329
10330
|
/* @internal */
|
|
10330
10331
|
function computeLineStarts(text) {
|
|
10331
|
-
var result =
|
|
10332
|
+
var result = [];
|
|
10332
10333
|
var pos = 0;
|
|
10333
10334
|
var lineStart = 0;
|
|
10334
10335
|
while (pos < text.length) {
|
|
@@ -11889,12 +11890,36 @@ var ts;
|
|
|
11889
11890
|
pos++;
|
|
11890
11891
|
return token = 0 /* SyntaxKind.Unknown */;
|
|
11891
11892
|
}
|
|
11892
|
-
|
|
11893
|
+
var charAfterHash = codePointAt(text, pos + 1);
|
|
11894
|
+
if (charAfterHash === 92 /* CharacterCodes.backslash */) {
|
|
11895
|
+
pos++;
|
|
11896
|
+
var extendedCookedChar_1 = peekExtendedUnicodeEscape();
|
|
11897
|
+
if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) {
|
|
11898
|
+
pos += 3;
|
|
11899
|
+
tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */;
|
|
11900
|
+
tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
|
|
11901
|
+
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
11902
|
+
}
|
|
11903
|
+
var cookedChar_1 = peekUnicodeEscape();
|
|
11904
|
+
if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) {
|
|
11905
|
+
pos += 6;
|
|
11906
|
+
tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */;
|
|
11907
|
+
tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts();
|
|
11908
|
+
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
11909
|
+
}
|
|
11910
|
+
pos--;
|
|
11911
|
+
}
|
|
11912
|
+
if (isIdentifierStart(charAfterHash, languageVersion)) {
|
|
11893
11913
|
pos++;
|
|
11894
|
-
scanIdentifier
|
|
11914
|
+
// We're relying on scanIdentifier's behavior and adjusting the token kind after the fact.
|
|
11915
|
+
// Notably absent from this block is the fact that calling a function named "scanIdentifier",
|
|
11916
|
+
// but identifiers don't include '#', and that function doesn't deal with it at all.
|
|
11917
|
+
// This works because 'scanIdentifier' tries to reuse source characters and builds up substrings;
|
|
11918
|
+
// however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us.
|
|
11919
|
+
scanIdentifier(charAfterHash, languageVersion);
|
|
11895
11920
|
}
|
|
11896
11921
|
else {
|
|
11897
|
-
tokenValue =
|
|
11922
|
+
tokenValue = "#";
|
|
11898
11923
|
error(ts.Diagnostics.Invalid_character, pos++, charSize(ch));
|
|
11899
11924
|
}
|
|
11900
11925
|
return token = 80 /* SyntaxKind.PrivateIdentifier */;
|
|
@@ -13461,7 +13486,7 @@ var ts;
|
|
|
13461
13486
|
// Node Arrays
|
|
13462
13487
|
/* @internal */
|
|
13463
13488
|
function isNodeArray(array) {
|
|
13464
|
-
return
|
|
13489
|
+
return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end");
|
|
13465
13490
|
}
|
|
13466
13491
|
ts.isNodeArray = isNodeArray;
|
|
13467
13492
|
// Literals
|
|
@@ -14933,7 +14958,6 @@ var ts;
|
|
|
14933
14958
|
return emitNode && emitNode.flags || 0;
|
|
14934
14959
|
}
|
|
14935
14960
|
ts.getEmitFlags = getEmitFlags;
|
|
14936
|
-
;
|
|
14937
14961
|
function getScriptTargetFeatures() {
|
|
14938
14962
|
return {
|
|
14939
14963
|
es2015: {
|
|
@@ -19659,7 +19683,7 @@ var ts;
|
|
|
19659
19683
|
}
|
|
19660
19684
|
function isWatchSet(options) {
|
|
19661
19685
|
// Firefox has Object.prototype.watch
|
|
19662
|
-
return options.watch &&
|
|
19686
|
+
return options.watch && ts.hasProperty(options, "watch");
|
|
19663
19687
|
}
|
|
19664
19688
|
ts.isWatchSet = isWatchSet;
|
|
19665
19689
|
function closeFileWatcher(watcher) {
|
|
@@ -26944,7 +26968,7 @@ var ts;
|
|
|
26944
26968
|
clone.transformFlags = node.transformFlags;
|
|
26945
26969
|
setOriginalNode(clone, node);
|
|
26946
26970
|
for (var key in node) {
|
|
26947
|
-
if (
|
|
26971
|
+
if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) {
|
|
26948
26972
|
continue;
|
|
26949
26973
|
}
|
|
26950
26974
|
clone[key] = node[key];
|
|
@@ -31832,7 +31856,6 @@ var ts;
|
|
|
31832
31856
|
visitNodes(cbNode, cbNodes, node.parameters) ||
|
|
31833
31857
|
visitNode(cbNode, node.type);
|
|
31834
31858
|
}
|
|
31835
|
-
;
|
|
31836
31859
|
function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) {
|
|
31837
31860
|
return visitNodes(cbNode, cbNodes, node.types);
|
|
31838
31861
|
}
|
|
@@ -33134,7 +33157,7 @@ var ts;
|
|
|
33134
33157
|
}
|
|
33135
33158
|
function parsePrivateIdentifier() {
|
|
33136
33159
|
var pos = getNodePos();
|
|
33137
|
-
var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.
|
|
33160
|
+
var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue()));
|
|
33138
33161
|
nextToken();
|
|
33139
33162
|
return finishNode(node, pos);
|
|
33140
33163
|
}
|
|
@@ -43148,7 +43171,7 @@ var ts;
|
|
|
43148
43171
|
function convertCompilerOptionsForTelemetry(opts) {
|
|
43149
43172
|
var out = {};
|
|
43150
43173
|
for (var key in opts) {
|
|
43151
|
-
if (
|
|
43174
|
+
if (ts.hasProperty(opts, key)) {
|
|
43152
43175
|
var type = getOptionFromName(key);
|
|
43153
43176
|
if (type !== undefined) { // Ignore unknown options
|
|
43154
43177
|
out[key] = getOptionValueWithEmptyStrings(opts[key], type);
|
|
@@ -49652,7 +49675,8 @@ var ts;
|
|
|
49652
49675
|
var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
|
|
49653
49676
|
emptyTypeLiteralSymbol.members = ts.createSymbolTable();
|
|
49654
49677
|
var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49655
|
-
var
|
|
49678
|
+
var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49679
|
+
var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
|
|
49656
49680
|
var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49657
49681
|
emptyGenericType.instantiations = new ts.Map();
|
|
49658
49682
|
var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
@@ -49766,6 +49790,8 @@ var ts;
|
|
|
49766
49790
|
var deferredGlobalOmitSymbol;
|
|
49767
49791
|
var deferredGlobalAwaitedSymbol;
|
|
49768
49792
|
var deferredGlobalBigIntType;
|
|
49793
|
+
var deferredGlobalNaNSymbol;
|
|
49794
|
+
var deferredGlobalRecordSymbol;
|
|
49769
49795
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49770
49796
|
var flowLoopStart = 0;
|
|
49771
49797
|
var flowLoopCount = 0;
|
|
@@ -50561,12 +50587,13 @@ var ts;
|
|
|
50561
50587
|
* the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
|
|
50562
50588
|
* the given name can be found.
|
|
50563
50589
|
*
|
|
50590
|
+
* @param nameNotFoundMessage If defined, we will report errors found during resolve.
|
|
50564
50591
|
* @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
|
|
50565
50592
|
*/
|
|
50566
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals,
|
|
50593
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) {
|
|
50567
50594
|
if (excludeGlobals === void 0) { excludeGlobals = false; }
|
|
50568
|
-
if (
|
|
50569
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals,
|
|
50595
|
+
if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; }
|
|
50596
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
|
|
50570
50597
|
}
|
|
50571
50598
|
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
50572
50599
|
var _a, _b, _c;
|
|
@@ -50724,7 +50751,9 @@ var ts;
|
|
|
50724
50751
|
// TypeScript 1.0 spec (April 2014): 3.4.1
|
|
50725
50752
|
// The scope of a type parameter extends over the entire declaration with which the type
|
|
50726
50753
|
// parameter list is associated, with the exception of static member declarations in classes.
|
|
50727
|
-
|
|
50754
|
+
if (nameNotFoundMessage) {
|
|
50755
|
+
error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
50756
|
+
}
|
|
50728
50757
|
return undefined;
|
|
50729
50758
|
}
|
|
50730
50759
|
break loop;
|
|
@@ -50762,7 +50791,9 @@ var ts;
|
|
|
50762
50791
|
if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) {
|
|
50763
50792
|
// A reference to this grandparent's type parameters would be an error
|
|
50764
50793
|
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) {
|
|
50765
|
-
|
|
50794
|
+
if (nameNotFoundMessage) {
|
|
50795
|
+
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
50796
|
+
}
|
|
50766
50797
|
return undefined;
|
|
50767
50798
|
}
|
|
50768
50799
|
}
|
|
@@ -50958,7 +50989,7 @@ var ts;
|
|
|
50958
50989
|
}
|
|
50959
50990
|
return undefined;
|
|
50960
50991
|
}
|
|
50961
|
-
else if (checkAndReportErrorForInvalidInitializer()) {
|
|
50992
|
+
else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
|
|
50962
50993
|
return undefined;
|
|
50963
50994
|
}
|
|
50964
50995
|
// Perform extra checks only if error reporting was requested
|
|
@@ -57119,7 +57150,6 @@ var ts;
|
|
|
57119
57150
|
return container;
|
|
57120
57151
|
}
|
|
57121
57152
|
}
|
|
57122
|
-
;
|
|
57123
57153
|
}
|
|
57124
57154
|
/** Create a synthetic property access flow node after the last statement of the file */
|
|
57125
57155
|
function getFlowTypeFromCommonJSExport(symbol) {
|
|
@@ -60249,7 +60279,7 @@ var ts;
|
|
|
60249
60279
|
var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
|
|
60250
60280
|
// If the symbols are instances of one another with identical types - consider the symbols
|
|
60251
60281
|
// equivalent and just use the first one, which thus allows us to avoid eliding private
|
|
60252
|
-
// members when intersecting a (this-)instantiations of a class with
|
|
60282
|
+
// members when intersecting a (this-)instantiations of a class with its raw base or another instance
|
|
60253
60283
|
if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
|
|
60254
60284
|
// If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
|
|
60255
60285
|
// to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
|
|
@@ -60297,7 +60327,11 @@ var ts;
|
|
|
60297
60327
|
}
|
|
60298
60328
|
}
|
|
60299
60329
|
}
|
|
60300
|
-
if (!singleProp ||
|
|
60330
|
+
if (!singleProp ||
|
|
60331
|
+
isUnion &&
|
|
60332
|
+
(propSet || checkFlags & 48 /* CheckFlags.Partial */) &&
|
|
60333
|
+
checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) &&
|
|
60334
|
+
!(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) {
|
|
60301
60335
|
// No property was found, or, in a union, a property has a private or protected declaration in one
|
|
60302
60336
|
// constituent, but is missing or has a different declaration in another constituent.
|
|
60303
60337
|
return undefined;
|
|
@@ -60399,6 +60433,33 @@ var ts;
|
|
|
60399
60433
|
}
|
|
60400
60434
|
return property;
|
|
60401
60435
|
}
|
|
60436
|
+
function getCommonDeclarationsOfSymbols(symbols) {
|
|
60437
|
+
var commonDeclarations;
|
|
60438
|
+
var _loop_14 = function (symbol) {
|
|
60439
|
+
if (!symbol.declarations) {
|
|
60440
|
+
return { value: undefined };
|
|
60441
|
+
}
|
|
60442
|
+
if (!commonDeclarations) {
|
|
60443
|
+
commonDeclarations = new ts.Set(symbol.declarations);
|
|
60444
|
+
return "continue";
|
|
60445
|
+
}
|
|
60446
|
+
commonDeclarations.forEach(function (declaration) {
|
|
60447
|
+
if (!ts.contains(symbol.declarations, declaration)) {
|
|
60448
|
+
commonDeclarations.delete(declaration);
|
|
60449
|
+
}
|
|
60450
|
+
});
|
|
60451
|
+
if (commonDeclarations.size === 0) {
|
|
60452
|
+
return { value: undefined };
|
|
60453
|
+
}
|
|
60454
|
+
};
|
|
60455
|
+
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
|
|
60456
|
+
var symbol = symbols_3[_i];
|
|
60457
|
+
var state_4 = _loop_14(symbol);
|
|
60458
|
+
if (typeof state_4 === "object")
|
|
60459
|
+
return state_4.value;
|
|
60460
|
+
}
|
|
60461
|
+
return commonDeclarations;
|
|
60462
|
+
}
|
|
60402
60463
|
function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
|
|
60403
60464
|
var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
60404
60465
|
// We need to filter out partial properties in union types
|
|
@@ -61113,7 +61174,7 @@ var ts;
|
|
|
61113
61174
|
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
61114
61175
|
if (indexSymbol.declarations) {
|
|
61115
61176
|
var indexInfos_4 = [];
|
|
61116
|
-
var
|
|
61177
|
+
var _loop_15 = function (declaration) {
|
|
61117
61178
|
if (declaration.parameters.length === 1) {
|
|
61118
61179
|
var parameter = declaration.parameters[0];
|
|
61119
61180
|
if (parameter.type) {
|
|
@@ -61127,7 +61188,7 @@ var ts;
|
|
|
61127
61188
|
};
|
|
61128
61189
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
61129
61190
|
var declaration = _a[_i];
|
|
61130
|
-
|
|
61191
|
+
_loop_15(declaration);
|
|
61131
61192
|
}
|
|
61132
61193
|
return indexInfos_4;
|
|
61133
61194
|
}
|
|
@@ -61144,7 +61205,7 @@ var ts;
|
|
|
61144
61205
|
var _a;
|
|
61145
61206
|
var inferences;
|
|
61146
61207
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
61147
|
-
var
|
|
61208
|
+
var _loop_16 = function (declaration) {
|
|
61148
61209
|
if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
|
|
61149
61210
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
61150
61211
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -61208,7 +61269,7 @@ var ts;
|
|
|
61208
61269
|
};
|
|
61209
61270
|
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
61210
61271
|
var declaration = _b[_i];
|
|
61211
|
-
|
|
61272
|
+
_loop_16(declaration);
|
|
61212
61273
|
}
|
|
61213
61274
|
}
|
|
61214
61275
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61865,6 +61926,13 @@ var ts;
|
|
|
61865
61926
|
function getGlobalBigIntType() {
|
|
61866
61927
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61867
61928
|
}
|
|
61929
|
+
function getGlobalNaNSymbol() {
|
|
61930
|
+
return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
|
|
61931
|
+
}
|
|
61932
|
+
function getGlobalRecordSymbol() {
|
|
61933
|
+
deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61934
|
+
return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
|
|
61935
|
+
}
|
|
61868
61936
|
/**
|
|
61869
61937
|
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
|
61870
61938
|
*/
|
|
@@ -62101,7 +62169,7 @@ var ts;
|
|
|
62101
62169
|
var lastRequiredIndex = -1;
|
|
62102
62170
|
var firstRestIndex = -1;
|
|
62103
62171
|
var lastOptionalOrRestIndex = -1;
|
|
62104
|
-
var
|
|
62172
|
+
var _loop_17 = function (i) {
|
|
62105
62173
|
var type = elementTypes[i];
|
|
62106
62174
|
var flags = target.elementFlags[i];
|
|
62107
62175
|
if (flags & 8 /* ElementFlags.Variadic */) {
|
|
@@ -62131,9 +62199,9 @@ var ts;
|
|
|
62131
62199
|
}
|
|
62132
62200
|
};
|
|
62133
62201
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
62134
|
-
var
|
|
62135
|
-
if (typeof
|
|
62136
|
-
return
|
|
62202
|
+
var state_5 = _loop_17(i);
|
|
62203
|
+
if (typeof state_5 === "object")
|
|
62204
|
+
return state_5.value;
|
|
62137
62205
|
}
|
|
62138
62206
|
// Turn optional elements preceding the last required element into required elements
|
|
62139
62207
|
for (var i = 0; i < lastRequiredIndex; i++) {
|
|
@@ -62161,7 +62229,7 @@ var ts;
|
|
|
62161
62229
|
if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
|
|
62162
62230
|
lastOptionalOrRestIndex = expandedFlags.length;
|
|
62163
62231
|
}
|
|
62164
|
-
expandedTypes.push(type);
|
|
62232
|
+
expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
|
|
62165
62233
|
expandedFlags.push(flags);
|
|
62166
62234
|
if (expandedDeclarations && declaration) {
|
|
62167
62235
|
expandedDeclarations.push(declaration);
|
|
@@ -62327,7 +62395,7 @@ var ts;
|
|
|
62327
62395
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
62328
62396
|
if (templates.length) {
|
|
62329
62397
|
var i = types.length;
|
|
62330
|
-
var
|
|
62398
|
+
var _loop_18 = function () {
|
|
62331
62399
|
i--;
|
|
62332
62400
|
var t = types[i];
|
|
62333
62401
|
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -62335,7 +62403,7 @@ var ts;
|
|
|
62335
62403
|
}
|
|
62336
62404
|
};
|
|
62337
62405
|
while (i > 0) {
|
|
62338
|
-
|
|
62406
|
+
_loop_18();
|
|
62339
62407
|
}
|
|
62340
62408
|
}
|
|
62341
62409
|
}
|
|
@@ -62412,14 +62480,14 @@ var ts;
|
|
|
62412
62480
|
var namedUnions = [];
|
|
62413
62481
|
addNamedUnions(namedUnions, types);
|
|
62414
62482
|
var reducedTypes = [];
|
|
62415
|
-
var
|
|
62483
|
+
var _loop_19 = function (t) {
|
|
62416
62484
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
62417
62485
|
reducedTypes.push(t);
|
|
62418
62486
|
}
|
|
62419
62487
|
};
|
|
62420
62488
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
62421
62489
|
var t = typeSet_1[_i];
|
|
62422
|
-
|
|
62490
|
+
_loop_19(t);
|
|
62423
62491
|
}
|
|
62424
62492
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
62425
62493
|
return namedUnions[0];
|
|
@@ -63649,7 +63717,7 @@ var ts;
|
|
|
63649
63717
|
var result;
|
|
63650
63718
|
var extraTypes;
|
|
63651
63719
|
var tailCount = 0;
|
|
63652
|
-
var
|
|
63720
|
+
var _loop_20 = function () {
|
|
63653
63721
|
if (tailCount === 1000) {
|
|
63654
63722
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63655
63723
|
result = errorType;
|
|
@@ -63770,10 +63838,10 @@ var ts;
|
|
|
63770
63838
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63771
63839
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63772
63840
|
while (true) {
|
|
63773
|
-
var
|
|
63774
|
-
if (typeof
|
|
63775
|
-
return
|
|
63776
|
-
if (
|
|
63841
|
+
var state_6 = _loop_20();
|
|
63842
|
+
if (typeof state_6 === "object")
|
|
63843
|
+
return state_6.value;
|
|
63844
|
+
if (state_6 === "break")
|
|
63777
63845
|
break;
|
|
63778
63846
|
}
|
|
63779
63847
|
return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
|
|
@@ -66388,7 +66456,7 @@ var ts;
|
|
|
66388
66456
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
66389
66457
|
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
|
|
66390
66458
|
}
|
|
66391
|
-
var
|
|
66459
|
+
var _loop_21 = function (prop) {
|
|
66392
66460
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
66393
66461
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
66394
66462
|
if (reportErrors) {
|
|
@@ -66451,9 +66519,9 @@ var ts;
|
|
|
66451
66519
|
};
|
|
66452
66520
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
66453
66521
|
var prop = _b[_i];
|
|
66454
|
-
var
|
|
66455
|
-
if (typeof
|
|
66456
|
-
return
|
|
66522
|
+
var state_7 = _loop_21(prop);
|
|
66523
|
+
if (typeof state_7 === "object")
|
|
66524
|
+
return state_7.value;
|
|
66457
66525
|
}
|
|
66458
66526
|
return false;
|
|
66459
66527
|
}
|
|
@@ -67444,11 +67512,11 @@ var ts;
|
|
|
67444
67512
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
67445
67513
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
67446
67514
|
var matchingTypes = [];
|
|
67447
|
-
var
|
|
67515
|
+
var _loop_22 = function (combination) {
|
|
67448
67516
|
var hasMatch = false;
|
|
67449
67517
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
67450
67518
|
var type = _d[_c];
|
|
67451
|
-
var
|
|
67519
|
+
var _loop_23 = function (i) {
|
|
67452
67520
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
67453
67521
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
67454
67522
|
if (!targetProperty)
|
|
@@ -67464,8 +67532,8 @@ var ts;
|
|
|
67464
67532
|
}
|
|
67465
67533
|
};
|
|
67466
67534
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
67467
|
-
var
|
|
67468
|
-
switch (
|
|
67535
|
+
var state_9 = _loop_23(i);
|
|
67536
|
+
switch (state_9) {
|
|
67469
67537
|
case "continue-outer": continue outer;
|
|
67470
67538
|
}
|
|
67471
67539
|
}
|
|
@@ -67478,9 +67546,9 @@ var ts;
|
|
|
67478
67546
|
};
|
|
67479
67547
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
67480
67548
|
var combination = discriminantCombinations_1[_a];
|
|
67481
|
-
var
|
|
67482
|
-
if (typeof
|
|
67483
|
-
return
|
|
67549
|
+
var state_8 = _loop_22(combination);
|
|
67550
|
+
if (typeof state_8 === "object")
|
|
67551
|
+
return state_8.value;
|
|
67484
67552
|
}
|
|
67485
67553
|
// Compare the remaining non-discriminant properties of each match.
|
|
67486
67554
|
var result = -1 /* Ternary.True */;
|
|
@@ -68185,7 +68253,7 @@ var ts;
|
|
|
68185
68253
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
68186
68254
|
links.variances = ts.emptyArray;
|
|
68187
68255
|
var variances = [];
|
|
68188
|
-
var
|
|
68256
|
+
var _loop_24 = function (tp) {
|
|
68189
68257
|
var modifiers = getVarianceModifiers(tp);
|
|
68190
68258
|
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
|
|
68191
68259
|
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
|
|
@@ -68223,7 +68291,7 @@ var ts;
|
|
|
68223
68291
|
};
|
|
68224
68292
|
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
68225
68293
|
var tp = typeParameters_2[_i];
|
|
68226
|
-
|
|
68294
|
+
_loop_24(tp);
|
|
68227
68295
|
}
|
|
68228
68296
|
links.variances = variances;
|
|
68229
68297
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68815,7 +68883,8 @@ var ts;
|
|
|
68815
68883
|
function getOptionalType(type, isProperty) {
|
|
68816
68884
|
if (isProperty === void 0) { isProperty = false; }
|
|
68817
68885
|
ts.Debug.assert(strictNullChecks);
|
|
68818
|
-
|
|
68886
|
+
var missingOrUndefined = isProperty ? missingType : undefinedType;
|
|
68887
|
+
return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]);
|
|
68819
68888
|
}
|
|
68820
68889
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
68821
68890
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
@@ -70180,7 +70249,7 @@ var ts;
|
|
|
70180
70249
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
70181
70250
|
// succeed. That would be a pointless and confusing outcome.
|
|
70182
70251
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
70183
|
-
var
|
|
70252
|
+
var _loop_25 = function (i) {
|
|
70184
70253
|
var source_1 = matches ? matches[i] : neverType;
|
|
70185
70254
|
var target_3 = types[i];
|
|
70186
70255
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -70230,7 +70299,7 @@ var ts;
|
|
|
70230
70299
|
inferFromTypes(source_1, target_3);
|
|
70231
70300
|
};
|
|
70232
70301
|
for (var i = 0; i < types.length; i++) {
|
|
70233
|
-
|
|
70302
|
+
_loop_25(i);
|
|
70234
70303
|
}
|
|
70235
70304
|
}
|
|
70236
70305
|
}
|
|
@@ -70694,7 +70763,7 @@ var ts;
|
|
|
70694
70763
|
return name;
|
|
70695
70764
|
}
|
|
70696
70765
|
}
|
|
70697
|
-
if (ts.hasOnlyExpressionInitializer(declaration)) {
|
|
70766
|
+
if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
|
|
70698
70767
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
70699
70768
|
return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
|
|
70700
70769
|
}
|
|
@@ -70754,7 +70823,7 @@ var ts;
|
|
|
70754
70823
|
function mapTypesByKeyProperty(types, name) {
|
|
70755
70824
|
var map = new ts.Map();
|
|
70756
70825
|
var count = 0;
|
|
70757
|
-
var
|
|
70826
|
+
var _loop_26 = function (type) {
|
|
70758
70827
|
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
|
|
70759
70828
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70760
70829
|
if (discriminant) {
|
|
@@ -70780,9 +70849,9 @@ var ts;
|
|
|
70780
70849
|
};
|
|
70781
70850
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70782
70851
|
var type = types_15[_i];
|
|
70783
|
-
var
|
|
70784
|
-
if (typeof
|
|
70785
|
-
return
|
|
70852
|
+
var state_10 = _loop_26(type);
|
|
70853
|
+
if (typeof state_10 === "object")
|
|
70854
|
+
return state_10.value;
|
|
70786
70855
|
}
|
|
70787
70856
|
return count >= 10 && count * 2 >= types.length ? map : undefined;
|
|
70788
70857
|
}
|
|
@@ -72181,18 +72250,26 @@ var ts;
|
|
|
72181
72250
|
}
|
|
72182
72251
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
72183
72252
|
var prop = getPropertyOfType(type, propName);
|
|
72184
|
-
|
|
72185
|
-
|
|
72186
|
-
|
|
72187
|
-
|
|
72188
|
-
|
|
72189
|
-
|
|
72190
|
-
|
|
72191
|
-
|
|
72192
|
-
|
|
72193
|
-
|
|
72253
|
+
return prop ?
|
|
72254
|
+
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
72255
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
72256
|
+
}
|
|
72257
|
+
function narrowByInKeyword(type, nameType, assumeTrue) {
|
|
72258
|
+
var name = getPropertyNameFromType(nameType);
|
|
72259
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
72260
|
+
if (isKnownProperty) {
|
|
72261
|
+
// If the check is for a known property (i.e. a property declared in some constituent of
|
|
72262
|
+
// the target type), we filter the target type by presence of absence of the property.
|
|
72194
72263
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
72195
72264
|
}
|
|
72265
|
+
if (assumeTrue) {
|
|
72266
|
+
// If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
|
|
72267
|
+
// where X is the name of the property.
|
|
72268
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
72269
|
+
if (recordSymbol) {
|
|
72270
|
+
return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]);
|
|
72271
|
+
}
|
|
72272
|
+
}
|
|
72196
72273
|
return type;
|
|
72197
72274
|
}
|
|
72198
72275
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -72251,15 +72328,14 @@ var ts;
|
|
|
72251
72328
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
72252
72329
|
}
|
|
72253
72330
|
var target = getReferenceCandidate(expr.right);
|
|
72254
|
-
var leftType =
|
|
72255
|
-
if (leftType.flags &
|
|
72256
|
-
var name = ts.escapeLeadingUnderscores(leftType.value);
|
|
72331
|
+
var leftType = getTypeOfExpression(expr.left);
|
|
72332
|
+
if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) {
|
|
72257
72333
|
if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
|
|
72258
|
-
getAccessedPropertyName(reference) ===
|
|
72334
|
+
getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
72259
72335
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
|
|
72260
72336
|
}
|
|
72261
72337
|
if (isMatchingReference(reference, target)) {
|
|
72262
|
-
return narrowByInKeyword(type,
|
|
72338
|
+
return narrowByInKeyword(type, leftType, assumeTrue);
|
|
72263
72339
|
}
|
|
72264
72340
|
}
|
|
72265
72341
|
break;
|
|
@@ -76429,7 +76505,6 @@ var ts;
|
|
|
76429
76505
|
}
|
|
76430
76506
|
return false;
|
|
76431
76507
|
}
|
|
76432
|
-
;
|
|
76433
76508
|
var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
|
|
76434
76509
|
if (!hasProp(suggestedMethod)) {
|
|
76435
76510
|
return undefined;
|
|
@@ -77231,7 +77306,7 @@ var ts;
|
|
|
77231
77306
|
if (spreadIndex >= 0) {
|
|
77232
77307
|
// Create synthetic arguments from spreads of tuple types.
|
|
77233
77308
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
77234
|
-
var
|
|
77309
|
+
var _loop_27 = function (i) {
|
|
77235
77310
|
var arg = args[i];
|
|
77236
77311
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
77237
77312
|
var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -77248,7 +77323,7 @@ var ts;
|
|
|
77248
77323
|
}
|
|
77249
77324
|
};
|
|
77250
77325
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
77251
|
-
|
|
77326
|
+
_loop_27(i);
|
|
77252
77327
|
}
|
|
77253
77328
|
return effectiveArgs_1;
|
|
77254
77329
|
}
|
|
@@ -77577,7 +77652,7 @@ var ts;
|
|
|
77577
77652
|
var min_3 = Number.MAX_VALUE;
|
|
77578
77653
|
var minIndex = 0;
|
|
77579
77654
|
var i_1 = 0;
|
|
77580
|
-
var
|
|
77655
|
+
var _loop_28 = function (c) {
|
|
77581
77656
|
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)); };
|
|
77582
77657
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
|
|
77583
77658
|
if (diags_2) {
|
|
@@ -77595,7 +77670,7 @@ var ts;
|
|
|
77595
77670
|
};
|
|
77596
77671
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
77597
77672
|
var c = candidatesForArgumentError_1[_a];
|
|
77598
|
-
|
|
77673
|
+
_loop_28(c);
|
|
77599
77674
|
}
|
|
77600
77675
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
77601
77676
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77753,7 +77828,7 @@ var ts;
|
|
|
77753
77828
|
}
|
|
77754
77829
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77755
77830
|
var parameters = [];
|
|
77756
|
-
var
|
|
77831
|
+
var _loop_29 = function (i) {
|
|
77757
77832
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77758
77833
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77759
77834
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77761,7 +77836,7 @@ var ts;
|
|
|
77761
77836
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77762
77837
|
};
|
|
77763
77838
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77764
|
-
|
|
77839
|
+
_loop_29(i);
|
|
77765
77840
|
}
|
|
77766
77841
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77767
77842
|
var flags = 0 /* SignatureFlags.None */;
|
|
@@ -80000,6 +80075,9 @@ var ts;
|
|
|
80000
80075
|
}
|
|
80001
80076
|
return booleanType;
|
|
80002
80077
|
}
|
|
80078
|
+
function hasEmptyObjectIntersection(type) {
|
|
80079
|
+
return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); });
|
|
80080
|
+
}
|
|
80003
80081
|
function checkInExpression(left, right, leftType, rightType) {
|
|
80004
80082
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
80005
80083
|
return silentNeverType;
|
|
@@ -80016,40 +80094,20 @@ var ts;
|
|
|
80016
80094
|
}
|
|
80017
80095
|
}
|
|
80018
80096
|
else {
|
|
80019
|
-
|
|
80020
|
-
|
|
80021
|
-
|
|
80022
|
-
|
|
80023
|
-
|
|
80024
|
-
|
|
80097
|
+
// The type of the lef operand must be assignable to string, number, or symbol.
|
|
80098
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
80099
|
+
}
|
|
80100
|
+
// The type of the right operand must be assignable to 'object'.
|
|
80101
|
+
if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
|
|
80102
|
+
// The {} type is assignable to the object type, yet {} might represent a primitive type. Here we
|
|
80103
|
+
// detect and error on {} that results from narrowing the unknown type, as well as intersections
|
|
80104
|
+
// that include {} (we know that the other types in such intersections are assignable to object
|
|
80105
|
+
// since we already checked for that).
|
|
80106
|
+
if (hasEmptyObjectIntersection(rightType)) {
|
|
80107
|
+
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));
|
|
80025
80108
|
}
|
|
80026
80109
|
}
|
|
80027
|
-
rightType = checkNonNullType(rightType, right);
|
|
80028
|
-
// TypeScript 1.0 spec (April 2014): 4.15.5
|
|
80029
|
-
// The in operator requires the right operand to be
|
|
80030
|
-
//
|
|
80031
|
-
// 1. assignable to the non-primitive type,
|
|
80032
|
-
// 2. an unconstrained type parameter,
|
|
80033
|
-
// 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
|
|
80034
|
-
// the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
|
|
80035
|
-
// non-primitive type, or
|
|
80036
|
-
// 4. a type parameter whose constraint is
|
|
80037
|
-
// i. an object type,
|
|
80038
|
-
// ii. the non-primitive type, or
|
|
80039
|
-
// iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
|
|
80040
|
-
//
|
|
80041
|
-
// The divergent behavior for type parameters and unions containing type parameters is a workaround for type
|
|
80042
|
-
// parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
|
|
80043
|
-
// it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
|
|
80044
|
-
// unless *all* instantiations would result in an error.
|
|
80045
|
-
//
|
|
80046
80110
|
// The result is always of the Boolean primitive type.
|
|
80047
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
80048
|
-
if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
80049
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
80050
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
|
|
80051
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
80052
|
-
}
|
|
80053
80111
|
return booleanType;
|
|
80054
80112
|
}
|
|
80055
80113
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
|
@@ -80560,6 +80618,7 @@ var ts;
|
|
|
80560
80618
|
var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
|
|
80561
80619
|
error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
|
|
80562
80620
|
}
|
|
80621
|
+
checkNaNEquality(errorNode, operator, left, right);
|
|
80563
80622
|
reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
|
|
80564
80623
|
return booleanType;
|
|
80565
80624
|
case 102 /* SyntaxKind.InstanceOfKeyword */:
|
|
@@ -80765,6 +80824,26 @@ var ts;
|
|
|
80765
80824
|
return undefined;
|
|
80766
80825
|
}
|
|
80767
80826
|
}
|
|
80827
|
+
function checkNaNEquality(errorNode, operator, left, right) {
|
|
80828
|
+
var isLeftNaN = isGlobalNaN(ts.skipParentheses(left));
|
|
80829
|
+
var isRightNaN = isGlobalNaN(ts.skipParentheses(right));
|
|
80830
|
+
if (isLeftNaN || isRightNaN) {
|
|
80831
|
+
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 */));
|
|
80832
|
+
if (isLeftNaN && isRightNaN)
|
|
80833
|
+
return;
|
|
80834
|
+
var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : "";
|
|
80835
|
+
var location = isLeftNaN ? right : left;
|
|
80836
|
+
var expression = ts.skipParentheses(location);
|
|
80837
|
+
ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")")));
|
|
80838
|
+
}
|
|
80839
|
+
}
|
|
80840
|
+
function isGlobalNaN(expr) {
|
|
80841
|
+
if (ts.isIdentifier(expr) && expr.escapedText === "NaN") {
|
|
80842
|
+
var globalNaNSymbol = getGlobalNaNSymbol();
|
|
80843
|
+
return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr);
|
|
80844
|
+
}
|
|
80845
|
+
return false;
|
|
80846
|
+
}
|
|
80768
80847
|
}
|
|
80769
80848
|
function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
|
|
80770
80849
|
var effectiveLeft = leftType;
|
|
@@ -81802,7 +81881,7 @@ var ts;
|
|
|
81802
81881
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81803
81882
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81804
81883
|
var indexSignatureMap_1 = new ts.Map();
|
|
81805
|
-
var
|
|
81884
|
+
var _loop_30 = function (declaration) {
|
|
81806
81885
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81807
81886
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81808
81887
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81817,7 +81896,7 @@ var ts;
|
|
|
81817
81896
|
};
|
|
81818
81897
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81819
81898
|
var declaration = _a[_i];
|
|
81820
|
-
|
|
81899
|
+
_loop_30(declaration);
|
|
81821
81900
|
}
|
|
81822
81901
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81823
81902
|
if (entry.declarations.length > 1) {
|
|
@@ -85417,7 +85496,7 @@ var ts;
|
|
|
85417
85496
|
var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
|
|
85418
85497
|
name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
|
|
85419
85498
|
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
85420
|
-
var
|
|
85499
|
+
var _loop_31 = function (info) {
|
|
85421
85500
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
85422
85501
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
85423
85502
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -85434,7 +85513,7 @@ var ts;
|
|
|
85434
85513
|
};
|
|
85435
85514
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
85436
85515
|
var info = indexInfos_9[_i];
|
|
85437
|
-
|
|
85516
|
+
_loop_31(info);
|
|
85438
85517
|
}
|
|
85439
85518
|
}
|
|
85440
85519
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -85442,7 +85521,7 @@ var ts;
|
|
|
85442
85521
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
85443
85522
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
|
|
85444
85523
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
85445
|
-
var
|
|
85524
|
+
var _loop_32 = function (info) {
|
|
85446
85525
|
if (info === checkInfo)
|
|
85447
85526
|
return "continue";
|
|
85448
85527
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -85457,7 +85536,7 @@ var ts;
|
|
|
85457
85536
|
};
|
|
85458
85537
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
85459
85538
|
var info = indexInfos_10[_i];
|
|
85460
|
-
|
|
85539
|
+
_loop_32(info);
|
|
85461
85540
|
}
|
|
85462
85541
|
}
|
|
85463
85542
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85777,7 +85856,7 @@ var ts;
|
|
|
85777
85856
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85778
85857
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85779
85858
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85780
|
-
var
|
|
85859
|
+
var _loop_33 = function (member) {
|
|
85781
85860
|
if (ts.hasAmbientModifier(member)) {
|
|
85782
85861
|
return "continue";
|
|
85783
85862
|
}
|
|
@@ -85794,7 +85873,7 @@ var ts;
|
|
|
85794
85873
|
};
|
|
85795
85874
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85796
85875
|
var member = _a[_i];
|
|
85797
|
-
|
|
85876
|
+
_loop_33(member);
|
|
85798
85877
|
}
|
|
85799
85878
|
}
|
|
85800
85879
|
/**
|
|
@@ -85882,7 +85961,7 @@ var ts;
|
|
|
85882
85961
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85883
85962
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
85884
85963
|
var issuedMemberError = false;
|
|
85885
|
-
var
|
|
85964
|
+
var _loop_34 = function (member) {
|
|
85886
85965
|
if (ts.isStatic(member)) {
|
|
85887
85966
|
return "continue";
|
|
85888
85967
|
}
|
|
@@ -85901,7 +85980,7 @@ var ts;
|
|
|
85901
85980
|
};
|
|
85902
85981
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85903
85982
|
var member = _a[_i];
|
|
85904
|
-
|
|
85983
|
+
_loop_34(member);
|
|
85905
85984
|
}
|
|
85906
85985
|
if (!issuedMemberError) {
|
|
85907
85986
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85972,7 +86051,7 @@ var ts;
|
|
|
85972
86051
|
var _a, _b, _c, _d;
|
|
85973
86052
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85974
86053
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85975
|
-
var
|
|
86054
|
+
var _loop_35 = function (baseProperty) {
|
|
85976
86055
|
var base = getTargetSymbol(baseProperty);
|
|
85977
86056
|
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
|
|
85978
86057
|
return "continue";
|
|
@@ -86082,8 +86161,8 @@ var ts;
|
|
|
86082
86161
|
};
|
|
86083
86162
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
86084
86163
|
var baseProperty = baseProperties_1[_i];
|
|
86085
|
-
var
|
|
86086
|
-
switch (
|
|
86164
|
+
var state_11 = _loop_35(baseProperty);
|
|
86165
|
+
switch (state_11) {
|
|
86087
86166
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
86088
86167
|
}
|
|
86089
86168
|
}
|
|
@@ -88491,7 +88570,7 @@ var ts;
|
|
|
88491
88570
|
}
|
|
88492
88571
|
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
|
|
88493
88572
|
if (node) {
|
|
88494
|
-
var symbol =
|
|
88573
|
+
var symbol = getReferencedValueOrAliasSymbol(node);
|
|
88495
88574
|
// We should only get the declaration of an alias if there isn't a local value
|
|
88496
88575
|
// declaration for the symbol
|
|
88497
88576
|
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
@@ -88858,6 +88937,25 @@ var ts;
|
|
|
88858
88937
|
}
|
|
88859
88938
|
return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
|
|
88860
88939
|
}
|
|
88940
|
+
/**
|
|
88941
|
+
* Get either a value-meaning symbol or an alias symbol.
|
|
88942
|
+
* Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol,
|
|
88943
|
+
* we call `resolveName` to find a symbol.
|
|
88944
|
+
* This is because when caching the resolved symbol, we only consider value symbols, but here
|
|
88945
|
+
* we want to also get an alias symbol if one exists.
|
|
88946
|
+
*/
|
|
88947
|
+
function getReferencedValueOrAliasSymbol(reference) {
|
|
88948
|
+
var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
|
|
88949
|
+
if (resolvedSymbol && resolvedSymbol !== unknownSymbol) {
|
|
88950
|
+
return resolvedSymbol;
|
|
88951
|
+
}
|
|
88952
|
+
return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */,
|
|
88953
|
+
/*nodeNotFoundMessage*/ undefined,
|
|
88954
|
+
/*nameArg*/ undefined,
|
|
88955
|
+
/*isUse*/ true,
|
|
88956
|
+
/*excludeGlobals*/ undefined,
|
|
88957
|
+
/*getSpellingSuggestions*/ undefined);
|
|
88958
|
+
}
|
|
88861
88959
|
function getReferencedValueDeclaration(referenceIn) {
|
|
88862
88960
|
if (!ts.isGeneratedIdentifier(referenceIn)) {
|
|
88863
88961
|
var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier);
|
|
@@ -95307,9 +95405,10 @@ var ts;
|
|
|
95307
95405
|
return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
|
|
95308
95406
|
}
|
|
95309
95407
|
function shouldEmitAliasDeclaration(node) {
|
|
95310
|
-
return
|
|
95311
|
-
|
|
95312
|
-
|
|
95408
|
+
return ts.isInJSFile(node) ||
|
|
95409
|
+
(compilerOptions.preserveValueImports
|
|
95410
|
+
? resolver.isValueAliasDeclaration(node)
|
|
95411
|
+
: resolver.isReferencedAliasDeclaration(node));
|
|
95313
95412
|
}
|
|
95314
95413
|
}
|
|
95315
95414
|
ts.transformTypeScript = transformTypeScript;
|
|
@@ -110481,7 +110580,7 @@ var ts;
|
|
|
110481
110580
|
var _a;
|
|
110482
110581
|
var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
|
|
110483
110582
|
var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
|
|
110484
|
-
if (augmentingDeclarations) {
|
|
110583
|
+
if (primaryDeclaration && augmentingDeclarations) {
|
|
110485
110584
|
for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
|
|
110486
110585
|
var augmentations = augmentingDeclarations_1[_i];
|
|
110487
110586
|
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)));
|
|
@@ -118530,7 +118629,6 @@ var ts;
|
|
|
118530
118629
|
return resolutions;
|
|
118531
118630
|
}
|
|
118532
118631
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
118533
|
-
;
|
|
118534
118632
|
/**
|
|
118535
118633
|
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
118536
118634
|
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
@@ -124907,7 +125005,7 @@ var ts;
|
|
|
124907
125005
|
});
|
|
124908
125006
|
// Sort by paths closest to importing file Name directory
|
|
124909
125007
|
var sortedPaths = [];
|
|
124910
|
-
var
|
|
125008
|
+
var _loop_36 = function (directory) {
|
|
124911
125009
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
124912
125010
|
var pathsInDirectory;
|
|
124913
125011
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -124931,9 +125029,9 @@ var ts;
|
|
|
124931
125029
|
};
|
|
124932
125030
|
var out_directory_1;
|
|
124933
125031
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
124934
|
-
var
|
|
125032
|
+
var state_12 = _loop_36(directory);
|
|
124935
125033
|
directory = out_directory_1;
|
|
124936
|
-
if (
|
|
125034
|
+
if (state_12 === "break")
|
|
124937
125035
|
break;
|
|
124938
125036
|
}
|
|
124939
125037
|
if (allFileNames.size) {
|
|
@@ -125002,7 +125100,7 @@ var ts;
|
|
|
125002
125100
|
}
|
|
125003
125101
|
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
125004
125102
|
for (var key in paths) {
|
|
125005
|
-
var
|
|
125103
|
+
var _loop_37 = function (patternText_1) {
|
|
125006
125104
|
var pattern = ts.normalizePath(patternText_1);
|
|
125007
125105
|
var indexOfStar = pattern.indexOf("*");
|
|
125008
125106
|
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
|
|
@@ -125069,9 +125167,9 @@ var ts;
|
|
|
125069
125167
|
};
|
|
125070
125168
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
125071
125169
|
var patternText_1 = _a[_i];
|
|
125072
|
-
var
|
|
125073
|
-
if (typeof
|
|
125074
|
-
return
|
|
125170
|
+
var state_13 = _loop_37(patternText_1);
|
|
125171
|
+
if (typeof state_13 === "object")
|
|
125172
|
+
return state_13.value;
|
|
125075
125173
|
}
|
|
125076
125174
|
}
|
|
125077
125175
|
function validateEnding(_a) {
|
|
@@ -135026,7 +135124,7 @@ var ts;
|
|
|
135026
135124
|
if (!dependencies)
|
|
135027
135125
|
continue;
|
|
135028
135126
|
for (var dep in dependencies) {
|
|
135029
|
-
if (
|
|
135127
|
+
if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) {
|
|
135030
135128
|
result.push(dep);
|
|
135031
135129
|
}
|
|
135032
135130
|
}
|
|
@@ -135410,7 +135508,7 @@ var ts;
|
|
|
135410
135508
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
135411
135509
|
}
|
|
135412
135510
|
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
135413
|
-
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,
|
|
135511
|
+
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;
|
|
135414
135512
|
// Verify if the file is JSX language variant
|
|
135415
135513
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) {
|
|
135416
135514
|
var completionInfo = getJsxClosingTagCompletion(location, sourceFile);
|
|
@@ -135424,7 +135522,7 @@ var ts;
|
|
|
135424
135522
|
return undefined;
|
|
135425
135523
|
}
|
|
135426
135524
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
135427
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer,
|
|
135525
|
+
/*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);
|
|
135428
135526
|
if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) {
|
|
135429
135527
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
135430
135528
|
var keywordEntry = _a[_i];
|
|
@@ -135542,7 +135640,7 @@ var ts;
|
|
|
135542
135640
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
135543
135641
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority };
|
|
135544
135642
|
}
|
|
135545
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
135643
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
135546
135644
|
var _a, _b;
|
|
135547
135645
|
var insertText;
|
|
135548
135646
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
@@ -135598,8 +135696,8 @@ var ts;
|
|
|
135598
135696
|
}
|
|
135599
135697
|
if (originIsResolvedExport(origin)) {
|
|
135600
135698
|
sourceDisplay = [ts.textPart(origin.moduleSpecifier)];
|
|
135601
|
-
if (
|
|
135602
|
-
(_a = getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
135699
|
+
if (importStatementCompletion) {
|
|
135700
|
+
(_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
|
|
135603
135701
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
135604
135702
|
}
|
|
135605
135703
|
}
|
|
@@ -135654,7 +135752,7 @@ var ts;
|
|
|
135654
135752
|
}
|
|
135655
135753
|
if (originIsExport(origin) || originIsResolvedExport(origin)) {
|
|
135656
135754
|
data = originToCompletionEntryData(origin);
|
|
135657
|
-
hasAction = !
|
|
135755
|
+
hasAction = !importStatementCompletion;
|
|
135658
135756
|
}
|
|
135659
135757
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
135660
135758
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
@@ -135677,7 +135775,7 @@ var ts;
|
|
|
135677
135775
|
labelDetails: labelDetails,
|
|
135678
135776
|
isSnippet: isSnippet,
|
|
135679
135777
|
isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
|
|
135680
|
-
isImportStatementCompletion: !!
|
|
135778
|
+
isImportStatementCompletion: !!importStatementCompletion || undefined,
|
|
135681
135779
|
data: data,
|
|
135682
135780
|
};
|
|
135683
135781
|
}
|
|
@@ -135879,7 +135977,6 @@ var ts;
|
|
|
135879
135977
|
var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) };
|
|
135880
135978
|
return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
|
|
135881
135979
|
}
|
|
135882
|
-
;
|
|
135883
135980
|
function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
|
|
135884
135981
|
var declarations = symbol.getDeclarations();
|
|
135885
135982
|
if (!(declarations && declarations.length)) {
|
|
@@ -136050,19 +136147,16 @@ var ts;
|
|
|
136050
136147
|
};
|
|
136051
136148
|
return unresolvedOrigin;
|
|
136052
136149
|
}
|
|
136053
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name,
|
|
136054
|
-
var
|
|
136055
|
-
var sourceFile = importCompletionNode.getSourceFile();
|
|
136056
|
-
var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile);
|
|
136150
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
136151
|
+
var replacementSpan = importStatementCompletion.replacementSpan;
|
|
136057
136152
|
var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
136058
136153
|
var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ :
|
|
136059
136154
|
origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ :
|
|
136060
136155
|
0 /* ExportKind.Named */;
|
|
136061
136156
|
var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
136062
136157
|
var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true);
|
|
136063
|
-
var
|
|
136064
|
-
var
|
|
136065
|
-
var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
136158
|
+
var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier;
|
|
136159
|
+
var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
|
|
136066
136160
|
var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : "";
|
|
136067
136161
|
var suffix = useSemicolons ? ";" : "";
|
|
136068
136162
|
switch (importKind) {
|
|
@@ -136096,7 +136190,7 @@ var ts;
|
|
|
136096
136190
|
return CompletionSource.TypeOnlyAlias;
|
|
136097
136191
|
}
|
|
136098
136192
|
}
|
|
136099
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer,
|
|
136193
|
+
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) {
|
|
136100
136194
|
var _a;
|
|
136101
136195
|
var start = ts.timestamp();
|
|
136102
136196
|
var variableDeclaration = getVariableDeclaration(location);
|
|
@@ -136117,7 +136211,7 @@ var ts;
|
|
|
136117
136211
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
136118
136212
|
var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority;
|
|
136119
136213
|
var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText);
|
|
136120
|
-
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer,
|
|
136214
|
+
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);
|
|
136121
136215
|
if (!entry) {
|
|
136122
136216
|
continue;
|
|
136123
136217
|
}
|
|
@@ -136308,7 +136402,7 @@ var ts;
|
|
|
136308
136402
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
136309
136403
|
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
|
|
136310
136404
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
136311
|
-
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).
|
|
136405
|
+
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
|
|
136312
136406
|
// Import statement completion: 'import c|'
|
|
136313
136407
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
136314
136408
|
}
|
|
@@ -136509,34 +136603,34 @@ var ts;
|
|
|
136509
136603
|
var isStartingCloseTag = false;
|
|
136510
136604
|
var isJsxInitializer = false;
|
|
136511
136605
|
var isJsxIdentifierExpected = false;
|
|
136512
|
-
var
|
|
136606
|
+
var importStatementCompletion;
|
|
136513
136607
|
var location = ts.getTouchingPropertyName(sourceFile, position);
|
|
136514
136608
|
var keywordFilters = 0 /* KeywordCompletionFilters.None */;
|
|
136515
136609
|
var isNewIdentifierLocation = false;
|
|
136516
136610
|
var flags = 0 /* CompletionInfoFlags.None */;
|
|
136517
136611
|
if (contextToken) {
|
|
136518
|
-
var
|
|
136519
|
-
|
|
136520
|
-
|
|
136521
|
-
if (importStatementCompletion.isKeywordOnlyCompletion) {
|
|
136612
|
+
var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
|
|
136613
|
+
if (importStatementCompletionInfo.keywordCompletion) {
|
|
136614
|
+
if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
|
|
136522
136615
|
return {
|
|
136523
136616
|
kind: 4 /* CompletionDataKind.Keywords */,
|
|
136524
|
-
keywordCompletions: [keywordToCompletionEntry(
|
|
136525
|
-
isNewIdentifierLocation: isNewIdentifierLocation,
|
|
136617
|
+
keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)],
|
|
136618
|
+
isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation,
|
|
136526
136619
|
};
|
|
136527
136620
|
}
|
|
136528
|
-
keywordFilters = keywordFiltersFromSyntaxKind(
|
|
136621
|
+
keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion);
|
|
136529
136622
|
}
|
|
136530
|
-
if (
|
|
136623
|
+
if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
|
|
136531
136624
|
// Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
|
|
136532
136625
|
// added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
|
|
136533
136626
|
// is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
|
|
136534
136627
|
// to opt in with the `includeCompletionsForImportStatements` user preference.
|
|
136535
|
-
importCompletionNode = importStatementCompletion.replacementNode;
|
|
136536
136628
|
flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */;
|
|
136629
|
+
importStatementCompletion = importStatementCompletionInfo;
|
|
136630
|
+
isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
|
|
136537
136631
|
}
|
|
136538
136632
|
// Bail out if this is a known invalid completion location
|
|
136539
|
-
if (!
|
|
136633
|
+
if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
|
|
136540
136634
|
log("Returning an empty list because completion was requested in an invalid position.");
|
|
136541
136635
|
return keywordFilters
|
|
136542
136636
|
? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation())
|
|
@@ -136582,7 +136676,7 @@ var ts;
|
|
|
136582
136676
|
return undefined;
|
|
136583
136677
|
}
|
|
136584
136678
|
}
|
|
136585
|
-
else if (!
|
|
136679
|
+
else if (!importStatementCompletion) {
|
|
136586
136680
|
// <UI.Test /* completion position */ />
|
|
136587
136681
|
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
|
|
136588
136682
|
// Then, try to get a JSX container and its associated attributes type.
|
|
@@ -136725,7 +136819,7 @@ var ts;
|
|
|
136725
136819
|
isTypeOnlyLocation: isTypeOnlyLocation,
|
|
136726
136820
|
isJsxIdentifierExpected: isJsxIdentifierExpected,
|
|
136727
136821
|
isRightOfOpenTag: isRightOfOpenTag,
|
|
136728
|
-
|
|
136822
|
+
importStatementCompletion: importStatementCompletion,
|
|
136729
136823
|
hasUnresolvedAutoImports: hasUnresolvedAutoImports,
|
|
136730
136824
|
flags: flags,
|
|
136731
136825
|
};
|
|
@@ -136979,7 +137073,7 @@ var ts;
|
|
|
136979
137073
|
return 1 /* GlobalsSearch.Success */;
|
|
136980
137074
|
}
|
|
136981
137075
|
function tryGetImportCompletionSymbols() {
|
|
136982
|
-
if (!
|
|
137076
|
+
if (!importStatementCompletion)
|
|
136983
137077
|
return 0 /* GlobalsSearch.Continue */;
|
|
136984
137078
|
isNewIdentifierLocation = true;
|
|
136985
137079
|
collectAutoImports();
|
|
@@ -137062,7 +137156,7 @@ var ts;
|
|
|
137062
137156
|
}
|
|
137063
137157
|
function shouldOfferImportCompletions() {
|
|
137064
137158
|
// If already typing an import statement, provide completions for it.
|
|
137065
|
-
if (
|
|
137159
|
+
if (importStatementCompletion)
|
|
137066
137160
|
return true;
|
|
137067
137161
|
// If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
|
|
137068
137162
|
if (isNonContextualObjectLiteral)
|
|
@@ -137092,7 +137186,7 @@ var ts;
|
|
|
137092
137186
|
}
|
|
137093
137187
|
function isTypeOnlyCompletion() {
|
|
137094
137188
|
return insideJsDocTagTypeExpression
|
|
137095
|
-
|| !!
|
|
137189
|
+
|| !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
|
|
137096
137190
|
|| !isContextTokenValueLocation(contextToken) &&
|
|
137097
137191
|
(ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
|
|
137098
137192
|
|| ts.isPartOfTypeNode(location)
|
|
@@ -137142,8 +137236,7 @@ var ts;
|
|
|
137142
137236
|
flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */;
|
|
137143
137237
|
// import { type | -> token text should be blank
|
|
137144
137238
|
var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
|
|
137145
|
-
&&
|
|
137146
|
-
&& couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
|
|
137239
|
+
&& importStatementCompletion;
|
|
137147
137240
|
var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" :
|
|
137148
137241
|
previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() :
|
|
137149
137242
|
"";
|
|
@@ -137151,14 +137244,14 @@ var ts;
|
|
|
137151
137244
|
var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken);
|
|
137152
137245
|
var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
137153
137246
|
var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
137154
|
-
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!
|
|
137247
|
+
resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
137155
137248
|
exportInfo.search(sourceFile.path,
|
|
137156
137249
|
/*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
|
|
137157
137250
|
if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
|
|
137158
137251
|
return false;
|
|
137159
137252
|
if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
|
|
137160
137253
|
return false;
|
|
137161
|
-
if (!isTypeOnlyLocation && !
|
|
137254
|
+
if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */))
|
|
137162
137255
|
return false;
|
|
137163
137256
|
if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */)))
|
|
137164
137257
|
return false;
|
|
@@ -137239,7 +137332,7 @@ var ts;
|
|
|
137239
137332
|
return;
|
|
137240
137333
|
}
|
|
137241
137334
|
symbolToOriginInfoMap[symbols.length] = origin;
|
|
137242
|
-
symbolToSortTextMap[symbolId] =
|
|
137335
|
+
symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
|
|
137243
137336
|
symbols.push(symbol);
|
|
137244
137337
|
}
|
|
137245
137338
|
/* Mutates `symbols` and `symbolToOriginInfoMap`. */
|
|
@@ -138506,6 +138599,7 @@ var ts;
|
|
|
138506
138599
|
return undefined;
|
|
138507
138600
|
}
|
|
138508
138601
|
function getImportStatementCompletionInfo(contextToken) {
|
|
138602
|
+
var _a, _b, _c;
|
|
138509
138603
|
var keywordCompletion;
|
|
138510
138604
|
var isKeywordOnlyCompletion = false;
|
|
138511
138605
|
var candidate = getCandidate();
|
|
@@ -138513,9 +138607,9 @@ var ts;
|
|
|
138513
138607
|
isKeywordOnlyCompletion: isKeywordOnlyCompletion,
|
|
138514
138608
|
keywordCompletion: keywordCompletion,
|
|
138515
138609
|
isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */),
|
|
138516
|
-
|
|
138517
|
-
|
|
138518
|
-
|
|
138610
|
+
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),
|
|
138611
|
+
couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken),
|
|
138612
|
+
replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate),
|
|
138519
138613
|
};
|
|
138520
138614
|
function getCandidate() {
|
|
138521
138615
|
var parent = contextToken.parent;
|
|
@@ -138557,14 +138651,71 @@ var ts;
|
|
|
138557
138651
|
return undefined;
|
|
138558
138652
|
}
|
|
138559
138653
|
}
|
|
138654
|
+
function getSingleLineReplacementSpanForImportCompletionNode(node) {
|
|
138655
|
+
var _a, _b, _c;
|
|
138656
|
+
if (!node)
|
|
138657
|
+
return undefined;
|
|
138658
|
+
var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node;
|
|
138659
|
+
var sourceFile = top.getSourceFile();
|
|
138660
|
+
if (ts.rangeIsOnSingleLine(top, sourceFile)) {
|
|
138661
|
+
return ts.createTextSpanFromNode(top, sourceFile);
|
|
138662
|
+
}
|
|
138663
|
+
// ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration
|
|
138664
|
+
ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */);
|
|
138665
|
+
// Guess which point in the import might actually be a later statement parsed as part of the import
|
|
138666
|
+
// during parser recovery - either in the middle of named imports, or the module specifier.
|
|
138667
|
+
var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */
|
|
138668
|
+
? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier
|
|
138669
|
+
: top.moduleReference;
|
|
138670
|
+
var withoutModuleSpecifier = {
|
|
138671
|
+
pos: top.getFirstToken().getStart(),
|
|
138672
|
+
end: potentialSplitPoint.pos,
|
|
138673
|
+
};
|
|
138674
|
+
// The module specifier/reference was previously found to be missing, empty, or
|
|
138675
|
+
// not a string literal - in this last case, it's likely that statement on a following
|
|
138676
|
+
// line was parsed as the module specifier of a partially-typed import, e.g.
|
|
138677
|
+
// import Foo|
|
|
138678
|
+
// interface Blah {}
|
|
138679
|
+
// This appears to be a multiline-import, and editors can't replace multiple lines.
|
|
138680
|
+
// But if everything but the "module specifier" is on one line, by this point we can
|
|
138681
|
+
// assume that the "module specifier" is actually just another statement, and return
|
|
138682
|
+
// the single-line range of the import excluding that probable statement.
|
|
138683
|
+
if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) {
|
|
138684
|
+
return ts.createTextSpanFromRange(withoutModuleSpecifier);
|
|
138685
|
+
}
|
|
138686
|
+
}
|
|
138687
|
+
// Tries to identify the first named import that is not really a named import, but rather
|
|
138688
|
+
// just parser recovery for a situation like:
|
|
138689
|
+
// import { Foo|
|
|
138690
|
+
// interface Bar {}
|
|
138691
|
+
// in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller
|
|
138692
|
+
// will also check if this token is on a separate line from the rest of the import.
|
|
138693
|
+
function getPotentiallyInvalidImportSpecifier(namedBindings) {
|
|
138694
|
+
var _a;
|
|
138695
|
+
return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) {
|
|
138696
|
+
var _a;
|
|
138697
|
+
return !e.propertyName &&
|
|
138698
|
+
ts.isStringANonContextualKeyword(e.name.text) &&
|
|
138699
|
+
((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */;
|
|
138700
|
+
});
|
|
138701
|
+
}
|
|
138560
138702
|
function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) {
|
|
138561
138703
|
return ts.isImportSpecifier(importSpecifier)
|
|
138562
138704
|
&& (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken));
|
|
138563
138705
|
}
|
|
138564
138706
|
function canCompleteFromNamedBindings(namedBindings) {
|
|
138565
|
-
|
|
138566
|
-
|
|
138567
|
-
|
|
138707
|
+
if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) {
|
|
138708
|
+
return false;
|
|
138709
|
+
}
|
|
138710
|
+
if (ts.isNamedImports(namedBindings)) {
|
|
138711
|
+
// We can only complete on named imports if there are no other named imports already,
|
|
138712
|
+
// but parser recovery sometimes puts later statements in the named imports list, so
|
|
138713
|
+
// we try to only consider the probably-valid ones.
|
|
138714
|
+
var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings);
|
|
138715
|
+
var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length;
|
|
138716
|
+
return validImports < 2;
|
|
138717
|
+
}
|
|
138718
|
+
return true;
|
|
138568
138719
|
}
|
|
138569
138720
|
function isModuleSpecifierMissingOrEmpty(specifier) {
|
|
138570
138721
|
var _a;
|
|
@@ -138583,7 +138734,6 @@ var ts;
|
|
|
138583
138734
|
function isArrowFunctionBody(node) {
|
|
138584
138735
|
return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node;
|
|
138585
138736
|
}
|
|
138586
|
-
;
|
|
138587
138737
|
/** True if symbol is a type or a module containing at least one type. */
|
|
138588
138738
|
function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
|
|
138589
138739
|
if (seenModules === void 0) { seenModules = new ts.Map(); }
|
|
@@ -149664,19 +149814,19 @@ var ts;
|
|
|
149664
149814
|
return function (context) { return context.options && context.options[optionName] === optionValue; };
|
|
149665
149815
|
}
|
|
149666
149816
|
function isOptionEnabled(optionName) {
|
|
149667
|
-
return function (context) { return context.options && context.options
|
|
149817
|
+
return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; };
|
|
149668
149818
|
}
|
|
149669
149819
|
function isOptionDisabled(optionName) {
|
|
149670
|
-
return function (context) { return context.options && context.options
|
|
149820
|
+
return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; };
|
|
149671
149821
|
}
|
|
149672
149822
|
function isOptionDisabledOrUndefined(optionName) {
|
|
149673
|
-
return function (context) { return !context.options || !context.options
|
|
149823
|
+
return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; };
|
|
149674
149824
|
}
|
|
149675
149825
|
function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) {
|
|
149676
|
-
return function (context) { return !context.options || !context.options
|
|
149826
|
+
return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
|
|
149677
149827
|
}
|
|
149678
149828
|
function isOptionEnabledOrUndefined(optionName) {
|
|
149679
|
-
return function (context) { return !context.options || !context.options
|
|
149829
|
+
return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; };
|
|
149680
149830
|
}
|
|
149681
149831
|
function isForContext(context) {
|
|
149682
149832
|
return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */;
|
|
@@ -157298,7 +157448,7 @@ var ts;
|
|
|
157298
157448
|
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
|
|
157299
157449
|
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
157300
157450
|
return;
|
|
157301
|
-
var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157451
|
+
var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
157302
157452
|
if (declaration === undefined)
|
|
157303
157453
|
return;
|
|
157304
157454
|
if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) {
|
|
@@ -157332,14 +157482,6 @@ var ts;
|
|
|
157332
157482
|
}
|
|
157333
157483
|
}
|
|
157334
157484
|
}
|
|
157335
|
-
function findAncestorMatchingSpan(sourceFile, span) {
|
|
157336
|
-
var end = ts.textSpanEnd(span);
|
|
157337
|
-
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
157338
|
-
while (token.end < end) {
|
|
157339
|
-
token = token.parent;
|
|
157340
|
-
}
|
|
157341
|
-
return token;
|
|
157342
|
-
}
|
|
157343
157485
|
function tryGetConstraintFromDiagnosticMessage(messageText) {
|
|
157344
157486
|
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1];
|
|
157345
157487
|
return constraint;
|
|
@@ -158885,6 +159027,63 @@ var ts;
|
|
|
158885
159027
|
})(ts || (ts = {}));
|
|
158886
159028
|
/* @internal */
|
|
158887
159029
|
var ts;
|
|
159030
|
+
(function (ts) {
|
|
159031
|
+
var codefix;
|
|
159032
|
+
(function (codefix) {
|
|
159033
|
+
var fixId = "fixNaNEquality";
|
|
159034
|
+
var errorCodes = [
|
|
159035
|
+
ts.Diagnostics.This_condition_will_always_return_0.code,
|
|
159036
|
+
];
|
|
159037
|
+
codefix.registerCodeFix({
|
|
159038
|
+
errorCodes: errorCodes,
|
|
159039
|
+
getCodeActions: function (context) {
|
|
159040
|
+
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
159041
|
+
var info = getInfo(program, sourceFile, span);
|
|
159042
|
+
if (info === undefined)
|
|
159043
|
+
return;
|
|
159044
|
+
var suggestion = info.suggestion, expression = info.expression, arg = info.arg;
|
|
159045
|
+
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); });
|
|
159046
|
+
return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
159047
|
+
},
|
|
159048
|
+
fixIds: [fixId],
|
|
159049
|
+
getAllCodeActions: function (context) {
|
|
159050
|
+
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
159051
|
+
var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length));
|
|
159052
|
+
if (info) {
|
|
159053
|
+
doChange(changes, diag.file, info.arg, info.expression);
|
|
159054
|
+
}
|
|
159055
|
+
});
|
|
159056
|
+
}
|
|
159057
|
+
});
|
|
159058
|
+
function getInfo(program, sourceFile, span) {
|
|
159059
|
+
var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
|
|
159060
|
+
if (diag === undefined || diag.relatedInformation === undefined)
|
|
159061
|
+
return;
|
|
159062
|
+
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; });
|
|
159063
|
+
if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
|
|
159064
|
+
return;
|
|
159065
|
+
var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
|
|
159066
|
+
if (token === undefined)
|
|
159067
|
+
return;
|
|
159068
|
+
if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) {
|
|
159069
|
+
return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token };
|
|
159070
|
+
}
|
|
159071
|
+
return undefined;
|
|
159072
|
+
}
|
|
159073
|
+
function doChange(changes, sourceFile, arg, expression) {
|
|
159074
|
+
var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]);
|
|
159075
|
+
var operator = expression.operatorToken.kind;
|
|
159076
|
+
changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */
|
|
159077
|
+
? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression);
|
|
159078
|
+
}
|
|
159079
|
+
function getSuggestion(messageText) {
|
|
159080
|
+
var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1];
|
|
159081
|
+
return suggestion;
|
|
159082
|
+
}
|
|
159083
|
+
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
159084
|
+
})(ts || (ts = {}));
|
|
159085
|
+
/* @internal */
|
|
159086
|
+
var ts;
|
|
158888
159087
|
(function (ts) {
|
|
158889
159088
|
var codefix;
|
|
158890
159089
|
(function (codefix) {
|
|
@@ -161602,6 +161801,15 @@ var ts;
|
|
|
161602
161801
|
symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); });
|
|
161603
161802
|
}
|
|
161604
161803
|
codefix.importSymbols = importSymbols;
|
|
161804
|
+
function findAncestorMatchingSpan(sourceFile, span) {
|
|
161805
|
+
var end = ts.textSpanEnd(span);
|
|
161806
|
+
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
161807
|
+
while (token.end < end) {
|
|
161808
|
+
token = token.parent;
|
|
161809
|
+
}
|
|
161810
|
+
return token;
|
|
161811
|
+
}
|
|
161812
|
+
codefix.findAncestorMatchingSpan = findAncestorMatchingSpan;
|
|
161605
161813
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
161606
161814
|
})(ts || (ts = {}));
|
|
161607
161815
|
/* @internal */
|
|
@@ -162660,7 +162868,6 @@ var ts;
|
|
|
162660
162868
|
return { edits: edits, renameFilename: undefined, renameLocation: undefined };
|
|
162661
162869
|
},
|
|
162662
162870
|
});
|
|
162663
|
-
;
|
|
162664
162871
|
function getInfo(context, considerPartialSpans) {
|
|
162665
162872
|
if (considerPartialSpans === void 0) { considerPartialSpans = true; }
|
|
162666
162873
|
var file = context.file, program = context.program;
|
|
@@ -163137,7 +163344,6 @@ var ts;
|
|
|
163137
163344
|
});
|
|
163138
163345
|
return { edits: edits, renameFilename: undefined, renameLocation: undefined };
|
|
163139
163346
|
}
|
|
163140
|
-
;
|
|
163141
163347
|
function isValidExpression(node) {
|
|
163142
163348
|
return ts.isBinaryExpression(node) || ts.isConditionalExpression(node);
|
|
163143
163349
|
}
|
|
@@ -163185,7 +163391,6 @@ var ts;
|
|
|
163185
163391
|
if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) {
|
|
163186
163392
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) };
|
|
163187
163393
|
}
|
|
163188
|
-
;
|
|
163189
163394
|
var finalExpression = getFinalExpressionInChain(expression.right);
|
|
163190
163395
|
if (!finalExpression)
|
|
163191
163396
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) };
|
|
@@ -165529,7 +165734,6 @@ var ts;
|
|
|
165529
165734
|
(function (ts) {
|
|
165530
165735
|
var refactor;
|
|
165531
165736
|
(function (refactor) {
|
|
165532
|
-
;
|
|
165533
165737
|
/**
|
|
165534
165738
|
* Checks if some refactor info has refactor error info.
|
|
165535
165739
|
*/
|
|
@@ -165634,7 +165838,6 @@ var ts;
|
|
|
165634
165838
|
// Imports will be copied to the new file anyway, and may still be needed in the old file.
|
|
165635
165839
|
// Prologue directives will be copied to the new file and should be left in the old file.
|
|
165636
165840
|
return !isPureImport(statement) && !ts.isPrologueDirective(statement);
|
|
165637
|
-
;
|
|
165638
165841
|
}
|
|
165639
165842
|
function isPureImport(node) {
|
|
165640
165843
|
switch (node.kind) {
|