@typescript-deploys/pr-build 4.9.0-pr-50666-16 → 4.9.0-pr-50691-11

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/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.9";
72
- ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220907");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220909");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -5852,6 +5852,8 @@ var ts;
5852
5852
  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."),
5853
5853
  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."),
5854
5854
  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."),
5855
+ 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'."),
5856
+ 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."),
5855
5857
  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."),
5856
5858
  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."),
5857
5859
  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."),
@@ -40543,6 +40545,7 @@ var ts;
40543
40545
  var wildcardType = createIntrinsicType(1, "any");
40544
40546
  var errorType = createIntrinsicType(1, "error");
40545
40547
  var unresolvedType = createIntrinsicType(1, "unresolved");
40548
+ var nonInferrableAnyType = createIntrinsicType(1, "any", 65536);
40546
40549
  var intrinsicMarkerType = createIntrinsicType(1, "intrinsic");
40547
40550
  var unknownType = createIntrinsicType(2, "unknown");
40548
40551
  var nonNullUnknownType = createIntrinsicType(2, "unknown");
@@ -40707,7 +40710,6 @@ var ts;
40707
40710
  var deferredGlobalOmitSymbol;
40708
40711
  var deferredGlobalAwaitedSymbol;
40709
40712
  var deferredGlobalBigIntType;
40710
- var deferredGlobalRecordSymbol;
40711
40713
  var allPotentiallyUnusedIdentifiers = new ts.Map();
40712
40714
  var flowLoopStart = 0;
40713
40715
  var flowLoopCount = 0;
@@ -47389,7 +47391,7 @@ var ts;
47389
47391
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
47390
47392
  reportImplicitAny(element, anyType);
47391
47393
  }
47392
- return anyType;
47394
+ return includePatternInType ? nonInferrableAnyType : anyType;
47393
47395
  }
47394
47396
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
47395
47397
  var members = ts.createSymbolTable();
@@ -51242,9 +51244,6 @@ var ts;
51242
51244
  function getGlobalBigIntType() {
51243
51245
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, false))) || emptyObjectType;
51244
51246
  }
51245
- function getGlobalRecordSymbol() {
51246
- return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", 2, true) || unknownSymbol);
51247
- }
51248
51247
  function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {
51249
51248
  return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
51250
51249
  }
@@ -58097,7 +58096,7 @@ var ts;
58097
58096
  }
58098
58097
  var inference = getInferenceInfoForType(target);
58099
58098
  if (inference) {
58100
- if (ts.getObjectFlags(source) & 262144) {
58099
+ if (ts.getObjectFlags(source) & 262144 || source === nonInferrableAnyType) {
58101
58100
  return;
58102
58101
  }
58103
58102
  if (!inference.isFixed) {
@@ -60219,22 +60218,18 @@ var ts;
60219
60218
  }
60220
60219
  function isTypePresencePossible(type, propName, assumeTrue) {
60221
60220
  var prop = getPropertyOfType(type, propName);
60222
- return prop ?
60223
- !!(prop.flags & 16777216) || assumeTrue :
60224
- !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
60221
+ if (prop) {
60222
+ return prop.flags & 16777216 ? true : assumeTrue;
60223
+ }
60224
+ return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
60225
60225
  }
60226
60226
  function narrowByInKeyword(type, name, assumeTrue) {
60227
- var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, true); });
60228
- if (isKnownProperty) {
60227
+ if (type.flags & 1048576
60228
+ || type.flags & 524288 && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
60229
+ || ts.isThisTypeParameter(type)
60230
+ || type.flags & 2097152 && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
60229
60231
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
60230
60232
  }
60231
- if (assumeTrue) {
60232
- var recordSymbol = getGlobalRecordSymbol();
60233
- if (recordSymbol !== unknownSymbol) {
60234
- var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
60235
- return mapType(type, function (t) { return t.flags & 67108864 ? record_1 : getIntersectionType([t, record_1]); });
60236
- }
60237
- }
60238
60233
  return type;
60239
60234
  }
60240
60235
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -66885,9 +66880,19 @@ var ts;
66885
66880
  }
66886
66881
  }
66887
66882
  else {
66888
- checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
66883
+ leftType = checkNonNullType(leftType, left);
66884
+ if (!(allTypesAssignableToKind(leftType, 402653316 | 296 | 12288) ||
66885
+ isTypeAssignableToKind(leftType, 4194304 | 134217728 | 268435456 | 262144))) {
66886
+ error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
66887
+ }
66888
+ }
66889
+ rightType = checkNonNullType(rightType, right);
66890
+ var rightTypeConstraint = getConstraintOfType(rightType);
66891
+ if (!allTypesAssignableToKind(rightType, 67108864 | 58982400) ||
66892
+ rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 | 58982400) ||
66893
+ !maybeTypeOfKind(rightTypeConstraint, 67108864 | 58982400 | 524288))) {
66894
+ error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
66889
66895
  }
66890
- checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
66891
66896
  return booleanType;
66892
66897
  }
66893
66898
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -76358,7 +76363,7 @@ var ts;
76358
76363
  return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
76359
76364
  }
76360
76365
  var nodeArguments = node.arguments;
76361
- if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
76366
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
76362
76367
  checkGrammarForDisallowedTrailingComma(nodeArguments);
76363
76368
  if (nodeArguments.length > 1) {
76364
76369
  var assertionArgument = nodeArguments[1];
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220907");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220909");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -8700,6 +8700,8 @@ var ts;
8700
8700
  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."),
8701
8701
  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."),
8702
8702
  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."),
8703
+ 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'."),
8704
+ 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."),
8703
8705
  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."),
8704
8706
  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."),
8705
8707
  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."),
@@ -49418,6 +49420,7 @@ var ts;
49418
49420
  var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any");
49419
49421
  var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error");
49420
49422
  var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved");
49423
+ var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */);
49421
49424
  var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic");
49422
49425
  var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
49423
49426
  var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
@@ -49593,7 +49596,6 @@ var ts;
49593
49596
  var deferredGlobalOmitSymbol;
49594
49597
  var deferredGlobalAwaitedSymbol;
49595
49598
  var deferredGlobalBigIntType;
49596
- var deferredGlobalRecordSymbol;
49597
49599
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49598
49600
  var flowLoopStart = 0;
49599
49601
  var flowLoopCount = 0;
@@ -57277,7 +57279,11 @@ var ts;
57277
57279
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
57278
57280
  reportImplicitAny(element, anyType);
57279
57281
  }
57280
- return anyType;
57282
+ // When we're including the pattern in the type (an indication we're obtaining a contextual type), we
57283
+ // use a non-inferrable any type. Inference will never directly infer this type, but it is possible
57284
+ // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
57285
+ // widening of the binding pattern type substitutes a regular any for the non-inferrable any.
57286
+ return includePatternInType ? nonInferrableAnyType : anyType;
57281
57287
  }
57282
57288
  // Return the type implied by an object binding pattern
57283
57289
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
@@ -61672,9 +61678,6 @@ var ts;
61672
61678
  function getGlobalBigIntType() {
61673
61679
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61674
61680
  }
61675
- function getGlobalRecordSymbol() {
61676
- return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61677
- }
61678
61681
  /**
61679
61682
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61680
61683
  */
@@ -69578,7 +69581,10 @@ var ts;
69578
69581
  //
69579
69582
  // This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
69580
69583
  // also non-inferrable.
69581
- if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) {
69584
+ //
69585
+ // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type
69586
+ // used as a stand-in for binding elements when they are being inferred.
69587
+ if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) {
69582
69588
  return;
69583
69589
  }
69584
69590
  if (!inference.isFixed) {
@@ -71962,26 +71968,18 @@ var ts;
71962
71968
  }
71963
71969
  function isTypePresencePossible(type, propName, assumeTrue) {
71964
71970
  var prop = getPropertyOfType(type, propName);
71965
- return prop ?
71966
- !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
71967
- !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
71971
+ if (prop) {
71972
+ return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
71973
+ }
71974
+ return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
71968
71975
  }
71969
71976
  function narrowByInKeyword(type, name, assumeTrue) {
71970
- var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
71971
- if (isKnownProperty) {
71972
- // If the check is for a known property (i.e. a property declared in some constituent of
71973
- // the target type), we filter the target type by presence of absence of the property.
71977
+ if (type.flags & 1048576 /* TypeFlags.Union */
71978
+ || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
71979
+ || ts.isThisTypeParameter(type)
71980
+ || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
71974
71981
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
71975
71982
  }
71976
- if (assumeTrue) {
71977
- // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
71978
- // where X is the name of the property.
71979
- var recordSymbol = getGlobalRecordSymbol();
71980
- if (recordSymbol !== unknownSymbol) {
71981
- var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
71982
- return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
71983
- }
71984
- }
71985
71983
  return type;
71986
71984
  }
71987
71985
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -79776,12 +79774,40 @@ var ts;
79776
79774
  }
79777
79775
  }
79778
79776
  else {
79779
- // The type of the lef operand must be assignable to string, number, or symbol.
79780
- checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
79777
+ leftType = checkNonNullType(leftType, left);
79778
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79779
+ // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
79780
+ if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
79781
+ isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
79782
+ error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
79783
+ }
79781
79784
  }
79782
- // The type of the right operand must be assignable to 'object'.
79783
- checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
79785
+ rightType = checkNonNullType(rightType, right);
79786
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79787
+ // The in operator requires the right operand to be
79788
+ //
79789
+ // 1. assignable to the non-primitive type,
79790
+ // 2. an unconstrained type parameter,
79791
+ // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
79792
+ // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
79793
+ // non-primitive type, or
79794
+ // 4. a type parameter whose constraint is
79795
+ // i. an object type,
79796
+ // ii. the non-primitive type, or
79797
+ // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
79798
+ //
79799
+ // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
79800
+ // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
79801
+ // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
79802
+ // unless *all* instantiations would result in an error.
79803
+ //
79784
79804
  // The result is always of the Boolean primitive type.
79805
+ var rightTypeConstraint = getConstraintOfType(rightType);
79806
+ if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79807
+ rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79808
+ !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
79809
+ error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
79810
+ }
79785
79811
  return booleanType;
79786
79812
  }
79787
79813
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -90587,7 +90613,7 @@ var ts;
90587
90613
  return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
90588
90614
  }
90589
90615
  var nodeArguments = node.arguments;
90590
- if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
90616
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
90591
90617
  // We are allowed trailing comma after proposal-import-assertions.
90592
90618
  checkGrammarForDisallowedTrailingComma(nodeArguments);
90593
90619
  if (nodeArguments.length > 1) {
@@ -148401,7 +148427,7 @@ var ts;
148401
148427
  rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */),
148402
148428
  // in other cases there should be no space between '?' and next token
148403
148429
  rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148404
- rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148430
+ rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnNumericLiteral], 16 /* RuleAction.DeleteSpace */),
148405
148431
  rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148406
148432
  rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */),
148407
148433
  // Special handling of unary operators.
@@ -149071,6 +149097,9 @@ var ts;
149071
149097
  function isSemicolonInsertionContext(context) {
149072
149098
  return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile);
149073
149099
  }
149100
+ function isNotPropertyAccessOnNumericLiteral(context) {
149101
+ return !ts.isPropertyAccessExpression(context.contextNode) || !ts.isNumericLiteral(context.contextNode.expression);
149102
+ }
149074
149103
  })(formatting = ts.formatting || (ts.formatting = {}));
149075
149104
  })(ts || (ts = {}));
149076
149105
  /* @internal */
@@ -108,7 +108,7 @@ var ts;
108
108
  // The following is baselined as a literal template type without intervention
109
109
  /** The version of the TypeScript compiler release */
110
110
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
111
- ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220907");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220909");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -8699,6 +8699,8 @@ var ts;
8699
8699
  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."),
8700
8700
  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."),
8701
8701
  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."),
8702
+ 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'."),
8703
+ 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."),
8702
8704
  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."),
8703
8705
  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."),
8704
8706
  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."),
@@ -49417,6 +49419,7 @@ var ts;
49417
49419
  var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any");
49418
49420
  var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error");
49419
49421
  var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved");
49422
+ var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */);
49420
49423
  var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic");
49421
49424
  var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
49422
49425
  var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
@@ -49592,7 +49595,6 @@ var ts;
49592
49595
  var deferredGlobalOmitSymbol;
49593
49596
  var deferredGlobalAwaitedSymbol;
49594
49597
  var deferredGlobalBigIntType;
49595
- var deferredGlobalRecordSymbol;
49596
49598
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49597
49599
  var flowLoopStart = 0;
49598
49600
  var flowLoopCount = 0;
@@ -57276,7 +57278,11 @@ var ts;
57276
57278
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
57277
57279
  reportImplicitAny(element, anyType);
57278
57280
  }
57279
- return anyType;
57281
+ // When we're including the pattern in the type (an indication we're obtaining a contextual type), we
57282
+ // use a non-inferrable any type. Inference will never directly infer this type, but it is possible
57283
+ // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
57284
+ // widening of the binding pattern type substitutes a regular any for the non-inferrable any.
57285
+ return includePatternInType ? nonInferrableAnyType : anyType;
57280
57286
  }
57281
57287
  // Return the type implied by an object binding pattern
57282
57288
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
@@ -61671,9 +61677,6 @@ var ts;
61671
61677
  function getGlobalBigIntType() {
61672
61678
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61673
61679
  }
61674
- function getGlobalRecordSymbol() {
61675
- return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61676
- }
61677
61680
  /**
61678
61681
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61679
61682
  */
@@ -69577,7 +69580,10 @@ var ts;
69577
69580
  //
69578
69581
  // This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
69579
69582
  // also non-inferrable.
69580
- if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) {
69583
+ //
69584
+ // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type
69585
+ // used as a stand-in for binding elements when they are being inferred.
69586
+ if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) {
69581
69587
  return;
69582
69588
  }
69583
69589
  if (!inference.isFixed) {
@@ -71961,26 +71967,18 @@ var ts;
71961
71967
  }
71962
71968
  function isTypePresencePossible(type, propName, assumeTrue) {
71963
71969
  var prop = getPropertyOfType(type, propName);
71964
- return prop ?
71965
- !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
71966
- !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
71970
+ if (prop) {
71971
+ return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
71972
+ }
71973
+ return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
71967
71974
  }
71968
71975
  function narrowByInKeyword(type, name, assumeTrue) {
71969
- var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
71970
- if (isKnownProperty) {
71971
- // If the check is for a known property (i.e. a property declared in some constituent of
71972
- // the target type), we filter the target type by presence of absence of the property.
71976
+ if (type.flags & 1048576 /* TypeFlags.Union */
71977
+ || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
71978
+ || ts.isThisTypeParameter(type)
71979
+ || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
71973
71980
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
71974
71981
  }
71975
- if (assumeTrue) {
71976
- // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
71977
- // where X is the name of the property.
71978
- var recordSymbol = getGlobalRecordSymbol();
71979
- if (recordSymbol !== unknownSymbol) {
71980
- var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
71981
- return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
71982
- }
71983
- }
71984
71982
  return type;
71985
71983
  }
71986
71984
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -79775,12 +79773,40 @@ var ts;
79775
79773
  }
79776
79774
  }
79777
79775
  else {
79778
- // The type of the lef operand must be assignable to string, number, or symbol.
79779
- checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
79776
+ leftType = checkNonNullType(leftType, left);
79777
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79778
+ // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
79779
+ if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
79780
+ isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
79781
+ error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
79782
+ }
79780
79783
  }
79781
- // The type of the right operand must be assignable to 'object'.
79782
- checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
79784
+ rightType = checkNonNullType(rightType, right);
79785
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79786
+ // The in operator requires the right operand to be
79787
+ //
79788
+ // 1. assignable to the non-primitive type,
79789
+ // 2. an unconstrained type parameter,
79790
+ // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
79791
+ // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
79792
+ // non-primitive type, or
79793
+ // 4. a type parameter whose constraint is
79794
+ // i. an object type,
79795
+ // ii. the non-primitive type, or
79796
+ // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
79797
+ //
79798
+ // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
79799
+ // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
79800
+ // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
79801
+ // unless *all* instantiations would result in an error.
79802
+ //
79783
79803
  // The result is always of the Boolean primitive type.
79804
+ var rightTypeConstraint = getConstraintOfType(rightType);
79805
+ if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79806
+ rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79807
+ !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
79808
+ error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
79809
+ }
79784
79810
  return booleanType;
79785
79811
  }
79786
79812
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -90586,7 +90612,7 @@ var ts;
90586
90612
  return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
90587
90613
  }
90588
90614
  var nodeArguments = node.arguments;
90589
- if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
90615
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
90590
90616
  // We are allowed trailing comma after proposal-import-assertions.
90591
90617
  checkGrammarForDisallowedTrailingComma(nodeArguments);
90592
90618
  if (nodeArguments.length > 1) {
@@ -148819,7 +148845,7 @@ var ts;
148819
148845
  rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */),
148820
148846
  // in other cases there should be no space between '?' and next token
148821
148847
  rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148822
- rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148848
+ rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnNumericLiteral], 16 /* RuleAction.DeleteSpace */),
148823
148849
  rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148824
148850
  rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */),
148825
148851
  // Special handling of unary operators.
@@ -149489,6 +149515,9 @@ var ts;
149489
149515
  function isSemicolonInsertionContext(context) {
149490
149516
  return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile);
149491
149517
  }
149518
+ function isNotPropertyAccessOnNumericLiteral(context) {
149519
+ return !ts.isPropertyAccessExpression(context.contextNode) || !ts.isNumericLiteral(context.contextNode.expression);
149520
+ }
149492
149521
  })(formatting = ts.formatting || (ts.formatting = {}));
149493
149522
  })(ts || (ts = {}));
149494
149523
  /* @internal */
package/lib/typescript.js CHANGED
@@ -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-insiders.20220907");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220909");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -8690,6 +8690,8 @@ var ts;
8690
8690
  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."),
8691
8691
  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."),
8692
8692
  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."),
8693
+ 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'."),
8694
+ 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."),
8693
8695
  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."),
8694
8696
  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."),
8695
8697
  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."),
@@ -49408,6 +49410,7 @@ var ts;
49408
49410
  var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any");
49409
49411
  var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error");
49410
49412
  var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved");
49413
+ var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */);
49411
49414
  var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic");
49412
49415
  var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
49413
49416
  var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
@@ -49583,7 +49586,6 @@ var ts;
49583
49586
  var deferredGlobalOmitSymbol;
49584
49587
  var deferredGlobalAwaitedSymbol;
49585
49588
  var deferredGlobalBigIntType;
49586
- var deferredGlobalRecordSymbol;
49587
49589
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49588
49590
  var flowLoopStart = 0;
49589
49591
  var flowLoopCount = 0;
@@ -57267,7 +57269,11 @@ var ts;
57267
57269
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
57268
57270
  reportImplicitAny(element, anyType);
57269
57271
  }
57270
- return anyType;
57272
+ // When we're including the pattern in the type (an indication we're obtaining a contextual type), we
57273
+ // use a non-inferrable any type. Inference will never directly infer this type, but it is possible
57274
+ // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
57275
+ // widening of the binding pattern type substitutes a regular any for the non-inferrable any.
57276
+ return includePatternInType ? nonInferrableAnyType : anyType;
57271
57277
  }
57272
57278
  // Return the type implied by an object binding pattern
57273
57279
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
@@ -61662,9 +61668,6 @@ var ts;
61662
61668
  function getGlobalBigIntType() {
61663
61669
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61664
61670
  }
61665
- function getGlobalRecordSymbol() {
61666
- return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61667
- }
61668
61671
  /**
61669
61672
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61670
61673
  */
@@ -69568,7 +69571,10 @@ var ts;
69568
69571
  //
69569
69572
  // This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
69570
69573
  // also non-inferrable.
69571
- if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) {
69574
+ //
69575
+ // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type
69576
+ // used as a stand-in for binding elements when they are being inferred.
69577
+ if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) {
69572
69578
  return;
69573
69579
  }
69574
69580
  if (!inference.isFixed) {
@@ -71952,26 +71958,18 @@ var ts;
71952
71958
  }
71953
71959
  function isTypePresencePossible(type, propName, assumeTrue) {
71954
71960
  var prop = getPropertyOfType(type, propName);
71955
- return prop ?
71956
- !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
71957
- !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
71961
+ if (prop) {
71962
+ return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
71963
+ }
71964
+ return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
71958
71965
  }
71959
71966
  function narrowByInKeyword(type, name, assumeTrue) {
71960
- var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
71961
- if (isKnownProperty) {
71962
- // If the check is for a known property (i.e. a property declared in some constituent of
71963
- // the target type), we filter the target type by presence of absence of the property.
71967
+ if (type.flags & 1048576 /* TypeFlags.Union */
71968
+ || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
71969
+ || ts.isThisTypeParameter(type)
71970
+ || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
71964
71971
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
71965
71972
  }
71966
- if (assumeTrue) {
71967
- // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
71968
- // where X is the name of the property.
71969
- var recordSymbol = getGlobalRecordSymbol();
71970
- if (recordSymbol !== unknownSymbol) {
71971
- var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
71972
- return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
71973
- }
71974
- }
71975
71973
  return type;
71976
71974
  }
71977
71975
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -79766,12 +79764,40 @@ var ts;
79766
79764
  }
79767
79765
  }
79768
79766
  else {
79769
- // The type of the lef operand must be assignable to string, number, or symbol.
79770
- checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
79767
+ leftType = checkNonNullType(leftType, left);
79768
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79769
+ // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
79770
+ if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
79771
+ isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
79772
+ error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
79773
+ }
79771
79774
  }
79772
- // The type of the right operand must be assignable to 'object'.
79773
- checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
79775
+ rightType = checkNonNullType(rightType, right);
79776
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79777
+ // The in operator requires the right operand to be
79778
+ //
79779
+ // 1. assignable to the non-primitive type,
79780
+ // 2. an unconstrained type parameter,
79781
+ // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
79782
+ // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
79783
+ // non-primitive type, or
79784
+ // 4. a type parameter whose constraint is
79785
+ // i. an object type,
79786
+ // ii. the non-primitive type, or
79787
+ // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
79788
+ //
79789
+ // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
79790
+ // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
79791
+ // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
79792
+ // unless *all* instantiations would result in an error.
79793
+ //
79774
79794
  // The result is always of the Boolean primitive type.
79795
+ var rightTypeConstraint = getConstraintOfType(rightType);
79796
+ if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79797
+ rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79798
+ !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
79799
+ error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
79800
+ }
79775
79801
  return booleanType;
79776
79802
  }
79777
79803
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -90577,7 +90603,7 @@ var ts;
90577
90603
  return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
90578
90604
  }
90579
90605
  var nodeArguments = node.arguments;
90580
- if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
90606
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
90581
90607
  // We are allowed trailing comma after proposal-import-assertions.
90582
90608
  checkGrammarForDisallowedTrailingComma(nodeArguments);
90583
90609
  if (nodeArguments.length > 1) {
@@ -148810,7 +148836,7 @@ var ts;
148810
148836
  rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */),
148811
148837
  // in other cases there should be no space between '?' and next token
148812
148838
  rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148813
- rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148839
+ rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnNumericLiteral], 16 /* RuleAction.DeleteSpace */),
148814
148840
  rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148815
148841
  rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */),
148816
148842
  // Special handling of unary operators.
@@ -149480,6 +149506,9 @@ var ts;
149480
149506
  function isSemicolonInsertionContext(context) {
149481
149507
  return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile);
149482
149508
  }
149509
+ function isNotPropertyAccessOnNumericLiteral(context) {
149510
+ return !ts.isPropertyAccessExpression(context.contextNode) || !ts.isNumericLiteral(context.contextNode.expression);
149511
+ }
149483
149512
  })(formatting = ts.formatting || (ts.formatting = {}));
149484
149513
  })(ts || (ts = {}));
149485
149514
  /* @internal */
@@ -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-insiders.20220907");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220909");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -8690,6 +8690,8 @@ var ts;
8690
8690
  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."),
8691
8691
  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."),
8692
8692
  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."),
8693
+ 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'."),
8694
+ 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."),
8693
8695
  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."),
8694
8696
  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."),
8695
8697
  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."),
@@ -49408,6 +49410,7 @@ var ts;
49408
49410
  var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any");
49409
49411
  var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error");
49410
49412
  var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved");
49413
+ var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */);
49411
49414
  var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic");
49412
49415
  var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
49413
49416
  var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
@@ -49583,7 +49586,6 @@ var ts;
49583
49586
  var deferredGlobalOmitSymbol;
49584
49587
  var deferredGlobalAwaitedSymbol;
49585
49588
  var deferredGlobalBigIntType;
49586
- var deferredGlobalRecordSymbol;
49587
49589
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49588
49590
  var flowLoopStart = 0;
49589
49591
  var flowLoopCount = 0;
@@ -57267,7 +57269,11 @@ var ts;
57267
57269
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
57268
57270
  reportImplicitAny(element, anyType);
57269
57271
  }
57270
- return anyType;
57272
+ // When we're including the pattern in the type (an indication we're obtaining a contextual type), we
57273
+ // use a non-inferrable any type. Inference will never directly infer this type, but it is possible
57274
+ // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
57275
+ // widening of the binding pattern type substitutes a regular any for the non-inferrable any.
57276
+ return includePatternInType ? nonInferrableAnyType : anyType;
57271
57277
  }
57272
57278
  // Return the type implied by an object binding pattern
57273
57279
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
@@ -61662,9 +61668,6 @@ var ts;
61662
61668
  function getGlobalBigIntType() {
61663
61669
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61664
61670
  }
61665
- function getGlobalRecordSymbol() {
61666
- return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61667
- }
61668
61671
  /**
61669
61672
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61670
61673
  */
@@ -69568,7 +69571,10 @@ var ts;
69568
69571
  //
69569
69572
  // This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
69570
69573
  // also non-inferrable.
69571
- if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) {
69574
+ //
69575
+ // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type
69576
+ // used as a stand-in for binding elements when they are being inferred.
69577
+ if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) {
69572
69578
  return;
69573
69579
  }
69574
69580
  if (!inference.isFixed) {
@@ -71952,26 +71958,18 @@ var ts;
71952
71958
  }
71953
71959
  function isTypePresencePossible(type, propName, assumeTrue) {
71954
71960
  var prop = getPropertyOfType(type, propName);
71955
- return prop ?
71956
- !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
71957
- !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
71961
+ if (prop) {
71962
+ return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
71963
+ }
71964
+ return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
71958
71965
  }
71959
71966
  function narrowByInKeyword(type, name, assumeTrue) {
71960
- var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
71961
- if (isKnownProperty) {
71962
- // If the check is for a known property (i.e. a property declared in some constituent of
71963
- // the target type), we filter the target type by presence of absence of the property.
71967
+ if (type.flags & 1048576 /* TypeFlags.Union */
71968
+ || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
71969
+ || ts.isThisTypeParameter(type)
71970
+ || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
71964
71971
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
71965
71972
  }
71966
- if (assumeTrue) {
71967
- // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
71968
- // where X is the name of the property.
71969
- var recordSymbol = getGlobalRecordSymbol();
71970
- if (recordSymbol !== unknownSymbol) {
71971
- var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
71972
- return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
71973
- }
71974
- }
71975
71973
  return type;
71976
71974
  }
71977
71975
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -79766,12 +79764,40 @@ var ts;
79766
79764
  }
79767
79765
  }
79768
79766
  else {
79769
- // The type of the lef operand must be assignable to string, number, or symbol.
79770
- checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
79767
+ leftType = checkNonNullType(leftType, left);
79768
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79769
+ // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
79770
+ if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
79771
+ isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
79772
+ error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
79773
+ }
79771
79774
  }
79772
- // The type of the right operand must be assignable to 'object'.
79773
- checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
79775
+ rightType = checkNonNullType(rightType, right);
79776
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79777
+ // The in operator requires the right operand to be
79778
+ //
79779
+ // 1. assignable to the non-primitive type,
79780
+ // 2. an unconstrained type parameter,
79781
+ // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
79782
+ // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
79783
+ // non-primitive type, or
79784
+ // 4. a type parameter whose constraint is
79785
+ // i. an object type,
79786
+ // ii. the non-primitive type, or
79787
+ // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
79788
+ //
79789
+ // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
79790
+ // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
79791
+ // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
79792
+ // unless *all* instantiations would result in an error.
79793
+ //
79774
79794
  // The result is always of the Boolean primitive type.
79795
+ var rightTypeConstraint = getConstraintOfType(rightType);
79796
+ if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79797
+ rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79798
+ !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
79799
+ error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
79800
+ }
79775
79801
  return booleanType;
79776
79802
  }
79777
79803
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -90577,7 +90603,7 @@ var ts;
90577
90603
  return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
90578
90604
  }
90579
90605
  var nodeArguments = node.arguments;
90580
- if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
90606
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
90581
90607
  // We are allowed trailing comma after proposal-import-assertions.
90582
90608
  checkGrammarForDisallowedTrailingComma(nodeArguments);
90583
90609
  if (nodeArguments.length > 1) {
@@ -148810,7 +148836,7 @@ var ts;
148810
148836
  rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */),
148811
148837
  // in other cases there should be no space between '?' and next token
148812
148838
  rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148813
- rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148839
+ rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnNumericLiteral], 16 /* RuleAction.DeleteSpace */),
148814
148840
  rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */),
148815
148841
  rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */),
148816
148842
  // Special handling of unary operators.
@@ -149480,6 +149506,9 @@ var ts;
149480
149506
  function isSemicolonInsertionContext(context) {
149481
149507
  return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile);
149482
149508
  }
149509
+ function isNotPropertyAccessOnNumericLiteral(context) {
149510
+ return !ts.isPropertyAccessExpression(context.contextNode) || !ts.isNumericLiteral(context.contextNode.expression);
149511
+ }
149483
149512
  })(formatting = ts.formatting || (ts.formatting = {}));
149484
149513
  })(ts || (ts = {}));
149485
149514
  /* @internal */
@@ -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-insiders.20220907");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220909");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8680,6 +8680,8 @@ var ts;
8680
8680
  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."),
8681
8681
  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."),
8682
8682
  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."),
8683
+ 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'."),
8684
+ 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."),
8683
8685
  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."),
8684
8686
  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."),
8685
8687
  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."),
@@ -49398,6 +49400,7 @@ var ts;
49398
49400
  var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any");
49399
49401
  var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error");
49400
49402
  var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved");
49403
+ var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */);
49401
49404
  var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic");
49402
49405
  var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
49403
49406
  var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown");
@@ -49573,7 +49576,6 @@ var ts;
49573
49576
  var deferredGlobalOmitSymbol;
49574
49577
  var deferredGlobalAwaitedSymbol;
49575
49578
  var deferredGlobalBigIntType;
49576
- var deferredGlobalRecordSymbol;
49577
49579
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49578
49580
  var flowLoopStart = 0;
49579
49581
  var flowLoopCount = 0;
@@ -57257,7 +57259,11 @@ var ts;
57257
57259
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
57258
57260
  reportImplicitAny(element, anyType);
57259
57261
  }
57260
- return anyType;
57262
+ // When we're including the pattern in the type (an indication we're obtaining a contextual type), we
57263
+ // use a non-inferrable any type. Inference will never directly infer this type, but it is possible
57264
+ // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
57265
+ // widening of the binding pattern type substitutes a regular any for the non-inferrable any.
57266
+ return includePatternInType ? nonInferrableAnyType : anyType;
57261
57267
  }
57262
57268
  // Return the type implied by an object binding pattern
57263
57269
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
@@ -61652,9 +61658,6 @@ var ts;
61652
61658
  function getGlobalBigIntType() {
61653
61659
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61654
61660
  }
61655
- function getGlobalRecordSymbol() {
61656
- return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61657
- }
61658
61661
  /**
61659
61662
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61660
61663
  */
@@ -69558,7 +69561,10 @@ var ts;
69558
69561
  //
69559
69562
  // This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
69560
69563
  // also non-inferrable.
69561
- if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) {
69564
+ //
69565
+ // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type
69566
+ // used as a stand-in for binding elements when they are being inferred.
69567
+ if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) {
69562
69568
  return;
69563
69569
  }
69564
69570
  if (!inference.isFixed) {
@@ -71942,26 +71948,18 @@ var ts;
71942
71948
  }
71943
71949
  function isTypePresencePossible(type, propName, assumeTrue) {
71944
71950
  var prop = getPropertyOfType(type, propName);
71945
- return prop ?
71946
- !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
71947
- !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
71951
+ if (prop) {
71952
+ return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
71953
+ }
71954
+ return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
71948
71955
  }
71949
71956
  function narrowByInKeyword(type, name, assumeTrue) {
71950
- var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
71951
- if (isKnownProperty) {
71952
- // If the check is for a known property (i.e. a property declared in some constituent of
71953
- // the target type), we filter the target type by presence of absence of the property.
71957
+ if (type.flags & 1048576 /* TypeFlags.Union */
71958
+ || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
71959
+ || ts.isThisTypeParameter(type)
71960
+ || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
71954
71961
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
71955
71962
  }
71956
- if (assumeTrue) {
71957
- // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
71958
- // where X is the name of the property.
71959
- var recordSymbol = getGlobalRecordSymbol();
71960
- if (recordSymbol !== unknownSymbol) {
71961
- var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
71962
- return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
71963
- }
71964
- }
71965
71963
  return type;
71966
71964
  }
71967
71965
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -79756,12 +79754,40 @@ var ts;
79756
79754
  }
79757
79755
  }
79758
79756
  else {
79759
- // The type of the lef operand must be assignable to string, number, or symbol.
79760
- checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
79757
+ leftType = checkNonNullType(leftType, left);
79758
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79759
+ // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
79760
+ if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
79761
+ isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
79762
+ error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
79763
+ }
79761
79764
  }
79762
- // The type of the right operand must be assignable to 'object'.
79763
- checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
79765
+ rightType = checkNonNullType(rightType, right);
79766
+ // TypeScript 1.0 spec (April 2014): 4.15.5
79767
+ // The in operator requires the right operand to be
79768
+ //
79769
+ // 1. assignable to the non-primitive type,
79770
+ // 2. an unconstrained type parameter,
79771
+ // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
79772
+ // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
79773
+ // non-primitive type, or
79774
+ // 4. a type parameter whose constraint is
79775
+ // i. an object type,
79776
+ // ii. the non-primitive type, or
79777
+ // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
79778
+ //
79779
+ // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
79780
+ // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
79781
+ // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
79782
+ // unless *all* instantiations would result in an error.
79783
+ //
79764
79784
  // The result is always of the Boolean primitive type.
79785
+ var rightTypeConstraint = getConstraintOfType(rightType);
79786
+ if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79787
+ rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
79788
+ !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
79789
+ error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
79790
+ }
79765
79791
  return booleanType;
79766
79792
  }
79767
79793
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -90567,7 +90593,7 @@ var ts;
90567
90593
  return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
90568
90594
  }
90569
90595
  var nodeArguments = node.arguments;
90570
- if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
90596
+ if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) {
90571
90597
  // We are allowed trailing comma after proposal-import-assertions.
90572
90598
  checkGrammarForDisallowedTrailingComma(nodeArguments);
90573
90599
  if (nodeArguments.length > 1) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.9.0-pr-50666-16",
5
+ "version": "4.9.0-pr-50691-11",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -91,7 +91,7 @@
91
91
  "ms": "^2.1.3",
92
92
  "node-fetch": "^2.6.7",
93
93
  "source-map-support": "latest",
94
- "typescript": "^4.8.2",
94
+ "typescript": "^4.8.3",
95
95
  "vinyl": "latest",
96
96
  "which": "^2.0.2",
97
97
  "xml2js": "^0.4.23"