typescript 4.9.0-dev.20220919 → 4.9.0-dev.20220920
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 +65 -55
- package/lib/tsserver.js +95 -89
- package/lib/tsserverlibrary.js +95 -89
- package/lib/typescript.js +94 -87
- package/lib/typescriptServices.js +94 -87
- package/lib/typingsInstaller.js +88 -74
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
92
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220920");
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -2673,7 +2673,7 @@ var ts;
|
|
|
2673
2673
|
if (typeof func !== "function") {
|
|
2674
2674
|
return "";
|
|
2675
2675
|
}
|
|
2676
|
-
else if (
|
|
2676
|
+
else if (ts.hasProperty(func, "name")) {
|
|
2677
2677
|
return func.name;
|
|
2678
2678
|
}
|
|
2679
2679
|
else {
|
|
@@ -2998,7 +2998,7 @@ var ts;
|
|
|
2998
2998
|
];
|
|
2999
2999
|
for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
|
|
3000
3000
|
var ctor = nodeConstructors_1[_i];
|
|
3001
|
-
if (!
|
|
3001
|
+
if (!ts.hasProperty(ctor, "__debugKind")) {
|
|
3002
3002
|
Object.defineProperties(ctor.prototype, {
|
|
3003
3003
|
// for use with vscode-js-debug's new customDescriptionGenerator in launch.json
|
|
3004
3004
|
__tsDebuggerDisplay: {
|
|
@@ -3853,7 +3853,6 @@ var ts;
|
|
|
3853
3853
|
var typeCatalog = []; // NB: id is index + 1
|
|
3854
3854
|
var legendPath;
|
|
3855
3855
|
var legend = [];
|
|
3856
|
-
;
|
|
3857
3856
|
/** Starts tracing for the given project. */
|
|
3858
3857
|
function startTracing(tracingMode, traceDir, configFilePath) {
|
|
3859
3858
|
ts.Debug.assert(!ts.tracing, "Tracing already started");
|
|
@@ -8685,8 +8684,6 @@ var ts;
|
|
|
8685
8684
|
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."),
|
|
8686
8685
|
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."),
|
|
8687
8686
|
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."),
|
|
8688
|
-
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'."),
|
|
8689
|
-
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."),
|
|
8690
8687
|
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."),
|
|
8691
8688
|
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."),
|
|
8692
8689
|
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."),
|
|
@@ -8935,6 +8932,7 @@ var ts;
|
|
|
8935
8932
|
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."),
|
|
8936
8933
|
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."),
|
|
8937
8934
|
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."),
|
|
8935
|
+
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."),
|
|
8938
8936
|
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."),
|
|
8939
8937
|
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."),
|
|
8940
8938
|
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."),
|
|
@@ -10318,7 +10316,7 @@ var ts;
|
|
|
10318
10316
|
ts.stringToToken = stringToToken;
|
|
10319
10317
|
/* @internal */
|
|
10320
10318
|
function computeLineStarts(text) {
|
|
10321
|
-
var result =
|
|
10319
|
+
var result = [];
|
|
10322
10320
|
var pos = 0;
|
|
10323
10321
|
var lineStart = 0;
|
|
10324
10322
|
while (pos < text.length) {
|
|
@@ -13451,7 +13449,7 @@ var ts;
|
|
|
13451
13449
|
// Node Arrays
|
|
13452
13450
|
/* @internal */
|
|
13453
13451
|
function isNodeArray(array) {
|
|
13454
|
-
return
|
|
13452
|
+
return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end");
|
|
13455
13453
|
}
|
|
13456
13454
|
ts.isNodeArray = isNodeArray;
|
|
13457
13455
|
// Literals
|
|
@@ -14923,7 +14921,6 @@ var ts;
|
|
|
14923
14921
|
return emitNode && emitNode.flags || 0;
|
|
14924
14922
|
}
|
|
14925
14923
|
ts.getEmitFlags = getEmitFlags;
|
|
14926
|
-
;
|
|
14927
14924
|
function getScriptTargetFeatures() {
|
|
14928
14925
|
return {
|
|
14929
14926
|
es2015: {
|
|
@@ -19649,7 +19646,7 @@ var ts;
|
|
|
19649
19646
|
}
|
|
19650
19647
|
function isWatchSet(options) {
|
|
19651
19648
|
// Firefox has Object.prototype.watch
|
|
19652
|
-
return options.watch &&
|
|
19649
|
+
return options.watch && ts.hasProperty(options, "watch");
|
|
19653
19650
|
}
|
|
19654
19651
|
ts.isWatchSet = isWatchSet;
|
|
19655
19652
|
function closeFileWatcher(watcher) {
|
|
@@ -26934,7 +26931,7 @@ var ts;
|
|
|
26934
26931
|
clone.transformFlags = node.transformFlags;
|
|
26935
26932
|
setOriginalNode(clone, node);
|
|
26936
26933
|
for (var key in node) {
|
|
26937
|
-
if (
|
|
26934
|
+
if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) {
|
|
26938
26935
|
continue;
|
|
26939
26936
|
}
|
|
26940
26937
|
clone[key] = node[key];
|
|
@@ -31822,7 +31819,6 @@ var ts;
|
|
|
31822
31819
|
visitNodes(cbNode, cbNodes, node.parameters) ||
|
|
31823
31820
|
visitNode(cbNode, node.type);
|
|
31824
31821
|
}
|
|
31825
|
-
;
|
|
31826
31822
|
function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) {
|
|
31827
31823
|
return visitNodes(cbNode, cbNodes, node.types);
|
|
31828
31824
|
}
|
|
@@ -43138,7 +43134,7 @@ var ts;
|
|
|
43138
43134
|
function convertCompilerOptionsForTelemetry(opts) {
|
|
43139
43135
|
var out = {};
|
|
43140
43136
|
for (var key in opts) {
|
|
43141
|
-
if (
|
|
43137
|
+
if (ts.hasProperty(opts, key)) {
|
|
43142
43138
|
var type = getOptionFromName(key);
|
|
43143
43139
|
if (type !== undefined) { // Ignore unknown options
|
|
43144
43140
|
out[key] = getOptionValueWithEmptyStrings(opts[key], type);
|
|
@@ -49642,7 +49638,8 @@ var ts;
|
|
|
49642
49638
|
var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
|
|
49643
49639
|
emptyTypeLiteralSymbol.members = ts.createSymbolTable();
|
|
49644
49640
|
var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49645
|
-
var
|
|
49641
|
+
var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49642
|
+
var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
|
|
49646
49643
|
var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49647
49644
|
emptyGenericType.instantiations = new ts.Map();
|
|
49648
49645
|
var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
@@ -49756,6 +49753,7 @@ var ts;
|
|
|
49756
49753
|
var deferredGlobalOmitSymbol;
|
|
49757
49754
|
var deferredGlobalAwaitedSymbol;
|
|
49758
49755
|
var deferredGlobalBigIntType;
|
|
49756
|
+
var deferredGlobalRecordSymbol;
|
|
49759
49757
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49760
49758
|
var flowLoopStart = 0;
|
|
49761
49759
|
var flowLoopCount = 0;
|
|
@@ -50551,12 +50549,13 @@ var ts;
|
|
|
50551
50549
|
* the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
|
|
50552
50550
|
* the given name can be found.
|
|
50553
50551
|
*
|
|
50552
|
+
* @param nameNotFoundMessage If defined, we will report errors found during resolve.
|
|
50554
50553
|
* @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
|
|
50555
50554
|
*/
|
|
50556
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals,
|
|
50555
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) {
|
|
50557
50556
|
if (excludeGlobals === void 0) { excludeGlobals = false; }
|
|
50558
|
-
if (
|
|
50559
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals,
|
|
50557
|
+
if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; }
|
|
50558
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
|
|
50560
50559
|
}
|
|
50561
50560
|
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
50562
50561
|
var _a, _b, _c;
|
|
@@ -50714,7 +50713,9 @@ var ts;
|
|
|
50714
50713
|
// TypeScript 1.0 spec (April 2014): 3.4.1
|
|
50715
50714
|
// The scope of a type parameter extends over the entire declaration with which the type
|
|
50716
50715
|
// parameter list is associated, with the exception of static member declarations in classes.
|
|
50717
|
-
|
|
50716
|
+
if (nameNotFoundMessage) {
|
|
50717
|
+
error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
50718
|
+
}
|
|
50718
50719
|
return undefined;
|
|
50719
50720
|
}
|
|
50720
50721
|
break loop;
|
|
@@ -50752,7 +50753,9 @@ var ts;
|
|
|
50752
50753
|
if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) {
|
|
50753
50754
|
// A reference to this grandparent's type parameters would be an error
|
|
50754
50755
|
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) {
|
|
50755
|
-
|
|
50756
|
+
if (nameNotFoundMessage) {
|
|
50757
|
+
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
50758
|
+
}
|
|
50756
50759
|
return undefined;
|
|
50757
50760
|
}
|
|
50758
50761
|
}
|
|
@@ -50948,7 +50951,7 @@ var ts;
|
|
|
50948
50951
|
}
|
|
50949
50952
|
return undefined;
|
|
50950
50953
|
}
|
|
50951
|
-
else if (checkAndReportErrorForInvalidInitializer()) {
|
|
50954
|
+
else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
|
|
50952
50955
|
return undefined;
|
|
50953
50956
|
}
|
|
50954
50957
|
// Perform extra checks only if error reporting was requested
|
|
@@ -57109,7 +57112,6 @@ var ts;
|
|
|
57109
57112
|
return container;
|
|
57110
57113
|
}
|
|
57111
57114
|
}
|
|
57112
|
-
;
|
|
57113
57115
|
}
|
|
57114
57116
|
/** Create a synthetic property access flow node after the last statement of the file */
|
|
57115
57117
|
function getFlowTypeFromCommonJSExport(symbol) {
|
|
@@ -61855,6 +61857,10 @@ var ts;
|
|
|
61855
61857
|
function getGlobalBigIntType() {
|
|
61856
61858
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61857
61859
|
}
|
|
61860
|
+
function getGlobalRecordSymbol() {
|
|
61861
|
+
deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61862
|
+
return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
|
|
61863
|
+
}
|
|
61858
61864
|
/**
|
|
61859
61865
|
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
|
61860
61866
|
*/
|
|
@@ -72171,18 +72177,26 @@ var ts;
|
|
|
72171
72177
|
}
|
|
72172
72178
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
72173
72179
|
var prop = getPropertyOfType(type, propName);
|
|
72174
|
-
|
|
72175
|
-
|
|
72176
|
-
|
|
72177
|
-
|
|
72178
|
-
|
|
72179
|
-
|
|
72180
|
-
|
|
72181
|
-
|
|
72182
|
-
|
|
72183
|
-
|
|
72180
|
+
return prop ?
|
|
72181
|
+
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
72182
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
72183
|
+
}
|
|
72184
|
+
function narrowByInKeyword(type, nameType, assumeTrue) {
|
|
72185
|
+
var name = getPropertyNameFromType(nameType);
|
|
72186
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
72187
|
+
if (isKnownProperty) {
|
|
72188
|
+
// If the check is for a known property (i.e. a property declared in some constituent of
|
|
72189
|
+
// the target type), we filter the target type by presence of absence of the property.
|
|
72184
72190
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
72185
72191
|
}
|
|
72192
|
+
if (assumeTrue) {
|
|
72193
|
+
// If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
|
|
72194
|
+
// where X is the name of the property.
|
|
72195
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
72196
|
+
if (recordSymbol) {
|
|
72197
|
+
return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]);
|
|
72198
|
+
}
|
|
72199
|
+
}
|
|
72186
72200
|
return type;
|
|
72187
72201
|
}
|
|
72188
72202
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -72241,15 +72255,14 @@ var ts;
|
|
|
72241
72255
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
72242
72256
|
}
|
|
72243
72257
|
var target = getReferenceCandidate(expr.right);
|
|
72244
|
-
var leftType =
|
|
72245
|
-
if (leftType.flags &
|
|
72246
|
-
var name = ts.escapeLeadingUnderscores(leftType.value);
|
|
72258
|
+
var leftType = getTypeOfExpression(expr.left);
|
|
72259
|
+
if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) {
|
|
72247
72260
|
if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
|
|
72248
|
-
getAccessedPropertyName(reference) ===
|
|
72261
|
+
getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
72249
72262
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
|
|
72250
72263
|
}
|
|
72251
72264
|
if (isMatchingReference(reference, target)) {
|
|
72252
|
-
return narrowByInKeyword(type,
|
|
72265
|
+
return narrowByInKeyword(type, leftType, assumeTrue);
|
|
72253
72266
|
}
|
|
72254
72267
|
}
|
|
72255
72268
|
break;
|
|
@@ -76419,7 +76432,6 @@ var ts;
|
|
|
76419
76432
|
}
|
|
76420
76433
|
return false;
|
|
76421
76434
|
}
|
|
76422
|
-
;
|
|
76423
76435
|
var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
|
|
76424
76436
|
if (!hasProp(suggestedMethod)) {
|
|
76425
76437
|
return undefined;
|
|
@@ -79990,6 +80002,9 @@ var ts;
|
|
|
79990
80002
|
}
|
|
79991
80003
|
return booleanType;
|
|
79992
80004
|
}
|
|
80005
|
+
function hasEmptyObjectIntersection(type) {
|
|
80006
|
+
return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); });
|
|
80007
|
+
}
|
|
79993
80008
|
function checkInExpression(left, right, leftType, rightType) {
|
|
79994
80009
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
79995
80010
|
return silentNeverType;
|
|
@@ -80006,40 +80021,20 @@ var ts;
|
|
|
80006
80021
|
}
|
|
80007
80022
|
}
|
|
80008
80023
|
else {
|
|
80009
|
-
|
|
80010
|
-
|
|
80011
|
-
|
|
80012
|
-
|
|
80013
|
-
|
|
80014
|
-
|
|
80024
|
+
// The type of the lef operand must be assignable to string, number, or symbol.
|
|
80025
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
80026
|
+
}
|
|
80027
|
+
// The type of the right operand must be assignable to 'object'.
|
|
80028
|
+
if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
|
|
80029
|
+
// The {} type is assignable to the object type, yet {} might represent a primitive type. Here we
|
|
80030
|
+
// detect and error on {} that results from narrowing the unknown type, as well as intersections
|
|
80031
|
+
// that include {} (we know that the other types in such intersections are assignable to object
|
|
80032
|
+
// since we already checked for that).
|
|
80033
|
+
if (hasEmptyObjectIntersection(rightType)) {
|
|
80034
|
+
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));
|
|
80015
80035
|
}
|
|
80016
80036
|
}
|
|
80017
|
-
rightType = checkNonNullType(rightType, right);
|
|
80018
|
-
// TypeScript 1.0 spec (April 2014): 4.15.5
|
|
80019
|
-
// The in operator requires the right operand to be
|
|
80020
|
-
//
|
|
80021
|
-
// 1. assignable to the non-primitive type,
|
|
80022
|
-
// 2. an unconstrained type parameter,
|
|
80023
|
-
// 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
|
|
80024
|
-
// the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
|
|
80025
|
-
// non-primitive type, or
|
|
80026
|
-
// 4. a type parameter whose constraint is
|
|
80027
|
-
// i. an object type,
|
|
80028
|
-
// ii. the non-primitive type, or
|
|
80029
|
-
// iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
|
|
80030
|
-
//
|
|
80031
|
-
// The divergent behavior for type parameters and unions containing type parameters is a workaround for type
|
|
80032
|
-
// parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
|
|
80033
|
-
// it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
|
|
80034
|
-
// unless *all* instantiations would result in an error.
|
|
80035
|
-
//
|
|
80036
80037
|
// The result is always of the Boolean primitive type.
|
|
80037
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
80038
|
-
if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
80039
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
80040
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
|
|
80041
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
80042
|
-
}
|
|
80043
80038
|
return booleanType;
|
|
80044
80039
|
}
|
|
80045
80040
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
|
@@ -88481,7 +88476,7 @@ var ts;
|
|
|
88481
88476
|
}
|
|
88482
88477
|
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
|
|
88483
88478
|
if (node) {
|
|
88484
|
-
var symbol =
|
|
88479
|
+
var symbol = getReferencedValueOrAliasSymbol(node);
|
|
88485
88480
|
// We should only get the declaration of an alias if there isn't a local value
|
|
88486
88481
|
// declaration for the symbol
|
|
88487
88482
|
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
@@ -88848,6 +88843,25 @@ var ts;
|
|
|
88848
88843
|
}
|
|
88849
88844
|
return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
|
|
88850
88845
|
}
|
|
88846
|
+
/**
|
|
88847
|
+
* Get either a value-meaning symbol or an alias symbol.
|
|
88848
|
+
* Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol,
|
|
88849
|
+
* we call `resolveName` to find a symbol.
|
|
88850
|
+
* This is because when caching the resolved symbol, we only consider value symbols, but here
|
|
88851
|
+
* we want to also get an alias symbol if one exists.
|
|
88852
|
+
*/
|
|
88853
|
+
function getReferencedValueOrAliasSymbol(reference) {
|
|
88854
|
+
var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
|
|
88855
|
+
if (resolvedSymbol && resolvedSymbol !== unknownSymbol) {
|
|
88856
|
+
return resolvedSymbol;
|
|
88857
|
+
}
|
|
88858
|
+
return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */,
|
|
88859
|
+
/*nodeNotFoundMessage*/ undefined,
|
|
88860
|
+
/*nameArg*/ undefined,
|
|
88861
|
+
/*isUse*/ true,
|
|
88862
|
+
/*excludeGlobals*/ undefined,
|
|
88863
|
+
/*getSpellingSuggestions*/ undefined);
|
|
88864
|
+
}
|
|
88851
88865
|
function getReferencedValueDeclaration(referenceIn) {
|
|
88852
88866
|
if (!ts.isGeneratedIdentifier(referenceIn)) {
|
|
88853
88867
|
var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier);
|
|
@@ -95297,9 +95311,10 @@ var ts;
|
|
|
95297
95311
|
return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
|
|
95298
95312
|
}
|
|
95299
95313
|
function shouldEmitAliasDeclaration(node) {
|
|
95300
|
-
return
|
|
95301
|
-
|
|
95302
|
-
|
|
95314
|
+
return ts.isInJSFile(node) ||
|
|
95315
|
+
(compilerOptions.preserveValueImports
|
|
95316
|
+
? resolver.isValueAliasDeclaration(node)
|
|
95317
|
+
: resolver.isReferencedAliasDeclaration(node));
|
|
95303
95318
|
}
|
|
95304
95319
|
}
|
|
95305
95320
|
ts.transformTypeScript = transformTypeScript;
|
|
@@ -110471,7 +110486,7 @@ var ts;
|
|
|
110471
110486
|
var _a;
|
|
110472
110487
|
var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
|
|
110473
110488
|
var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
|
|
110474
|
-
if (augmentingDeclarations) {
|
|
110489
|
+
if (primaryDeclaration && augmentingDeclarations) {
|
|
110475
110490
|
for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
|
|
110476
110491
|
var augmentations = augmentingDeclarations_1[_i];
|
|
110477
110492
|
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)));
|
|
@@ -118520,7 +118535,6 @@ var ts;
|
|
|
118520
118535
|
return resolutions;
|
|
118521
118536
|
}
|
|
118522
118537
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
118523
|
-
;
|
|
118524
118538
|
/**
|
|
118525
118539
|
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
118526
118540
|
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.9.0-dev.
|
|
5
|
+
"version": "4.9.0-dev.20220920",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|