typescript 4.6.0-dev.20211214 → 4.6.0-dev.20211219

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.
@@ -319,7 +319,7 @@ declare namespace Intl {
319
319
  *
320
320
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).
321
321
  */
322
- of(code: string): string;
322
+ of(code: string): string | undefined;
323
323
  /**
324
324
  * Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
325
325
  * [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
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.6";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20211214";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20211219";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -15608,7 +15608,7 @@ var ts;
15608
15608
  }
15609
15609
  ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
15610
15610
  function getUseDefineForClassFields(compilerOptions) {
15611
- return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) === 99 : compilerOptions.useDefineForClassFields;
15611
+ return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) >= 9 : compilerOptions.useDefineForClassFields;
15612
15612
  }
15613
15613
  ts.getUseDefineForClassFields = getUseDefineForClassFields;
15614
15614
  function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
@@ -27016,7 +27016,7 @@ var ts;
27016
27016
  return true;
27017
27017
  }
27018
27018
  }
27019
- else if (third === 27) {
27019
+ else if (third === 27 || third === 63) {
27020
27020
  return true;
27021
27021
  }
27022
27022
  return false;
@@ -45769,7 +45769,8 @@ var ts;
45769
45769
  return false;
45770
45770
  }
45771
45771
  function getBaseTypeNodeOfClass(type) {
45772
- return ts.getEffectiveBaseTypeNode(type.symbol.valueDeclaration);
45772
+ var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
45773
+ return decl && ts.getEffectiveBaseTypeNode(decl);
45773
45774
  }
45774
45775
  function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
45775
45776
  var typeArgCount = ts.length(typeArgumentNodes);
@@ -45783,8 +45784,8 @@ var ts;
45783
45784
  }
45784
45785
  function getBaseConstructorTypeOfClass(type) {
45785
45786
  if (!type.resolvedBaseConstructorType) {
45786
- var decl = type.symbol.valueDeclaration;
45787
- var extended = ts.getEffectiveBaseTypeNode(decl);
45787
+ var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
45788
+ var extended = decl && ts.getEffectiveBaseTypeNode(decl);
45788
45789
  var baseTypeNode = getBaseTypeNodeOfClass(type);
45789
45790
  if (!baseTypeNode) {
45790
45791
  return type.resolvedBaseConstructorType = undefinedType;
@@ -47518,8 +47519,14 @@ var ts;
47518
47519
  }
47519
47520
  return type;
47520
47521
  }
47522
+ function isMappedTypeGenericIndexedAccess(type) {
47523
+ return type.flags & 8388608 && ts.getObjectFlags(type.objectType) & 32 &&
47524
+ !isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
47525
+ }
47521
47526
  function getApparentType(type) {
47522
- var t = type.flags & 465829888 ? getBaseConstraintOfType(type) || unknownType : type;
47527
+ var t = !(type.flags & 465829888) ? type :
47528
+ isMappedTypeGenericIndexedAccess(type) ? substituteIndexedMappedType(type.objectType, type.indexType) :
47529
+ getBaseConstraintOfType(type) || unknownType;
47523
47530
  return ts.getObjectFlags(t) & 32 ? getApparentTypeOfMappedType(t) :
47524
47531
  t.flags & 2097152 ? getApparentTypeOfIntersectionType(t) :
47525
47532
  t.flags & 402653316 ? globalStringType :
@@ -48052,6 +48059,8 @@ var ts;
48052
48059
  case 205:
48053
48060
  case 206:
48054
48061
  return traverse(node.expression);
48062
+ case 294:
48063
+ return traverse(node.initializer);
48055
48064
  default:
48056
48065
  return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
48057
48066
  }
@@ -55554,12 +55563,14 @@ var ts;
55554
55563
  target = getActualTypeVariable(target);
55555
55564
  }
55556
55565
  if (target.flags & 8650752) {
55557
- if (ts.getObjectFlags(source) & 524288 || source === nonInferrableAnyType || source === silentNeverType ||
55558
- (priority & 128 && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
55566
+ if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
55559
55567
  return;
55560
55568
  }
55561
55569
  var inference = getInferenceInfoForType(target);
55562
55570
  if (inference) {
55571
+ if (ts.getObjectFlags(source) & 524288) {
55572
+ return;
55573
+ }
55563
55574
  if (!inference.isFixed) {
55564
55575
  if (inference.priority === undefined || priority < inference.priority) {
55565
55576
  inference.candidates = undefined;
@@ -55588,18 +55599,16 @@ var ts;
55588
55599
  inferencePriority = Math.min(inferencePriority, priority);
55589
55600
  return;
55590
55601
  }
55591
- else {
55592
- var simplified = getSimplifiedType(target, false);
55593
- if (simplified !== target) {
55594
- invokeOnce(source, simplified, inferFromTypes);
55595
- }
55596
- else if (target.flags & 8388608) {
55597
- var indexType = getSimplifiedType(target.indexType, false);
55598
- if (indexType.flags & 465829888) {
55599
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, false), indexType, false);
55600
- if (simplified_1 && simplified_1 !== target) {
55601
- invokeOnce(source, simplified_1, inferFromTypes);
55602
- }
55602
+ var simplified = getSimplifiedType(target, false);
55603
+ if (simplified !== target) {
55604
+ inferFromTypes(source, simplified);
55605
+ }
55606
+ else if (target.flags & 8388608) {
55607
+ var indexType = getSimplifiedType(target.indexType, false);
55608
+ if (indexType.flags & 465829888) {
55609
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, false), indexType, false);
55610
+ if (simplified_1 && simplified_1 !== target) {
55611
+ inferFromTypes(source, simplified_1);
55603
55612
  }
55604
55613
  }
55605
55614
  }
@@ -58116,7 +58125,7 @@ var ts;
58116
58125
  var substituteConstraints = !(checkMode && checkMode & 2) &&
58117
58126
  someType(type, isGenericTypeWithUnionConstraint) &&
58118
58127
  (isConstraintPosition(type, reference) || hasNonBindingPatternContextualTypeWithNoGenericTypes(reference));
58119
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 ? getBaseConstraintOrType(t) : t; }) : type;
58128
+ return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
58120
58129
  }
58121
58130
  function isExportOrExportExpression(location) {
58122
58131
  return !!ts.findAncestor(location, function (n) {
@@ -60563,11 +60572,14 @@ var ts;
60563
60572
  if (!ts.getContainingClass(privId)) {
60564
60573
  return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
60565
60574
  }
60566
- if (!ts.isExpressionNode(privId)) {
60567
- return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
60568
- }
60569
- if (!getSymbolForPrivateIdentifierExpression(privId)) {
60570
- return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
60575
+ if (!ts.isForInStatement(privId.parent)) {
60576
+ if (!ts.isExpressionNode(privId)) {
60577
+ return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
60578
+ }
60579
+ var isInOperation = ts.isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === 101;
60580
+ if (!getSymbolForPrivateIdentifierExpression(privId) && !isInOperation) {
60581
+ return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
60582
+ }
60571
60583
  }
60572
60584
  return false;
60573
60585
  }
@@ -72182,7 +72194,7 @@ var ts;
72182
72194
  checkGrammarComputedPropertyName(name);
72183
72195
  }
72184
72196
  if (prop.kind === 295 && !inDestructuring && prop.objectAssignmentInitializer) {
72185
- return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
72197
+ grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
72186
72198
  }
72187
72199
  if (name.kind === 80) {
72188
72200
  grammarErrorOnNode(name, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -76686,7 +76698,7 @@ var ts;
76686
76698
  var compilerOptions = context.getCompilerOptions();
76687
76699
  var languageVersion = ts.getEmitScriptTarget(compilerOptions);
76688
76700
  var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
76689
- var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 99;
76701
+ var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9;
76690
76702
  var shouldTransformSuperInStaticInitializers = (languageVersion <= 8 || !useDefineForClassFields) && languageVersion >= 2;
76691
76703
  var shouldTransformThisInStaticInitializers = languageVersion <= 8 || !useDefineForClassFields;
76692
76704
  var previousOnSubstituteNode = context.onSubstituteNode;
@@ -76706,7 +76718,7 @@ var ts;
76706
76718
  function transformSourceFile(node) {
76707
76719
  var options = context.getCompilerOptions();
76708
76720
  if (node.isDeclarationFile
76709
- || useDefineForClassFields && ts.getEmitScriptTarget(options) === 99) {
76721
+ || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9) {
76710
76722
  return node;
76711
76723
  }
76712
76724
  var visited = ts.visitEachChild(node, visitor, context);
@@ -77376,7 +77388,7 @@ var ts;
77376
77388
  return false;
77377
77389
  }
77378
77390
  if (useDefineForClassFields) {
77379
- return languageVersion < 99;
77391
+ return languageVersion < 9;
77380
77392
  }
77381
77393
  return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member);
77382
77394
  }
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20211214";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211219";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -19716,7 +19716,7 @@ var ts;
19716
19716
  }
19717
19717
  ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
19718
19718
  function getUseDefineForClassFields(compilerOptions) {
19719
- return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ : compilerOptions.useDefineForClassFields;
19719
+ return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
19720
19720
  }
19721
19721
  ts.getUseDefineForClassFields = getUseDefineForClassFields;
19722
19722
  function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
@@ -33531,7 +33531,7 @@ var ts;
33531
33531
  return true;
33532
33532
  }
33533
33533
  }
33534
- else if (third === 27 /* CommaToken */) {
33534
+ else if (third === 27 /* CommaToken */ || third === 63 /* EqualsToken */) {
33535
33535
  return true;
33536
33536
  }
33537
33537
  return false;
@@ -55397,7 +55397,8 @@ var ts;
55397
55397
  return false;
55398
55398
  }
55399
55399
  function getBaseTypeNodeOfClass(type) {
55400
- return ts.getEffectiveBaseTypeNode(type.symbol.valueDeclaration);
55400
+ var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
55401
+ return decl && ts.getEffectiveBaseTypeNode(decl);
55401
55402
  }
55402
55403
  function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
55403
55404
  var typeArgCount = ts.length(typeArgumentNodes);
@@ -55419,8 +55420,8 @@ var ts;
55419
55420
  */
55420
55421
  function getBaseConstructorTypeOfClass(type) {
55421
55422
  if (!type.resolvedBaseConstructorType) {
55422
- var decl = type.symbol.valueDeclaration;
55423
- var extended = ts.getEffectiveBaseTypeNode(decl);
55423
+ var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
55424
+ var extended = decl && ts.getEffectiveBaseTypeNode(decl);
55424
55425
  var baseTypeNode = getBaseTypeNodeOfClass(type);
55425
55426
  if (!baseTypeNode) {
55426
55427
  return type.resolvedBaseConstructorType = undefinedType;
@@ -57425,13 +57426,23 @@ var ts;
57425
57426
  }
57426
57427
  return type;
57427
57428
  }
57429
+ function isMappedTypeGenericIndexedAccess(type) {
57430
+ return type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(type.objectType) & 32 /* Mapped */ &&
57431
+ !isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
57432
+ }
57428
57433
  /**
57429
57434
  * For a type parameter, return the base constraint of the type parameter. For the string, number,
57430
57435
  * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
57431
57436
  * type itself.
57432
57437
  */
57433
57438
  function getApparentType(type) {
57434
- var t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
57439
+ // We obtain the base constraint for all instantiable types, except indexed access types of the form
57440
+ // { [P in K]: E }[X], where K is non-generic and X is generic. For those types, we instead substitute an
57441
+ // instantiation of E where P is replaced with X. We do this because getBaseConstraintOfType directly
57442
+ // lowers to an instantiation where X's constraint is substituted for X, which isn't always desirable.
57443
+ var t = !(type.flags & 465829888 /* Instantiable */) ? type :
57444
+ isMappedTypeGenericIndexedAccess(type) ? substituteIndexedMappedType(type.objectType, type.indexType) :
57445
+ getBaseConstraintOfType(type) || unknownType;
57435
57446
  return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
57436
57447
  t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
57437
57448
  t.flags & 402653316 /* StringLike */ ? globalStringType :
@@ -58047,6 +58058,8 @@ var ts;
58047
58058
  case 205 /* PropertyAccessExpression */:
58048
58059
  case 206 /* ElementAccessExpression */:
58049
58060
  return traverse(node.expression);
58061
+ case 294 /* PropertyAssignment */:
58062
+ return traverse(node.initializer);
58050
58063
  default:
58051
58064
  return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
58052
58065
  }
@@ -66616,12 +66629,14 @@ var ts;
66616
66629
  // not contain anyFunctionType when we come back to this argument for its second round
66617
66630
  // of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
66618
66631
  // when constructing types from type parameters that had no inference candidates).
66619
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === nonInferrableAnyType || source === silentNeverType ||
66620
- (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
66632
+ if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
66621
66633
  return;
66622
66634
  }
66623
66635
  var inference = getInferenceInfoForType(target);
66624
66636
  if (inference) {
66637
+ if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */) {
66638
+ return;
66639
+ }
66625
66640
  if (!inference.isFixed) {
66626
66641
  if (inference.priority === undefined || priority < inference.priority) {
66627
66642
  inference.candidates = undefined;
@@ -66652,21 +66667,19 @@ var ts;
66652
66667
  inferencePriority = Math.min(inferencePriority, priority);
66653
66668
  return;
66654
66669
  }
66655
- else {
66656
- // Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
66657
- var simplified = getSimplifiedType(target, /*writing*/ false);
66658
- if (simplified !== target) {
66659
- invokeOnce(source, simplified, inferFromTypes);
66660
- }
66661
- else if (target.flags & 8388608 /* IndexedAccess */) {
66662
- var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
66663
- // Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
66664
- // that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
66665
- if (indexType.flags & 465829888 /* Instantiable */) {
66666
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
66667
- if (simplified_1 && simplified_1 !== target) {
66668
- invokeOnce(source, simplified_1, inferFromTypes);
66669
- }
66670
+ // Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
66671
+ var simplified = getSimplifiedType(target, /*writing*/ false);
66672
+ if (simplified !== target) {
66673
+ inferFromTypes(source, simplified);
66674
+ }
66675
+ else if (target.flags & 8388608 /* IndexedAccess */) {
66676
+ var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
66677
+ // Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
66678
+ // that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
66679
+ if (indexType.flags & 465829888 /* Instantiable */) {
66680
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
66681
+ if (simplified_1 && simplified_1 !== target) {
66682
+ inferFromTypes(source, simplified_1);
66670
66683
  }
66671
66684
  }
66672
66685
  }
@@ -69536,7 +69549,7 @@ var ts;
69536
69549
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
69537
69550
  someType(type, isGenericTypeWithUnionConstraint) &&
69538
69551
  (isConstraintPosition(type, reference) || hasNonBindingPatternContextualTypeWithNoGenericTypes(reference));
69539
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
69552
+ return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
69540
69553
  }
69541
69554
  function isExportOrExportExpression(location) {
69542
69555
  return !!ts.findAncestor(location, function (n) {
@@ -72507,11 +72520,14 @@ var ts;
72507
72520
  if (!ts.getContainingClass(privId)) {
72508
72521
  return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
72509
72522
  }
72510
- if (!ts.isExpressionNode(privId)) {
72511
- return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
72512
- }
72513
- if (!getSymbolForPrivateIdentifierExpression(privId)) {
72514
- return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
72523
+ if (!ts.isForInStatement(privId.parent)) {
72524
+ if (!ts.isExpressionNode(privId)) {
72525
+ return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
72526
+ }
72527
+ var isInOperation = ts.isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === 101 /* InKeyword */;
72528
+ if (!getSymbolForPrivateIdentifierExpression(privId) && !isInOperation) {
72529
+ return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
72530
+ }
72515
72531
  }
72516
72532
  return false;
72517
72533
  }
@@ -85898,7 +85914,7 @@ var ts;
85898
85914
  if (prop.kind === 295 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
85899
85915
  // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
85900
85916
  // outside of destructuring it is a syntax error
85901
- return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
85917
+ grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
85902
85918
  }
85903
85919
  if (name.kind === 80 /* PrivateIdentifier */) {
85904
85920
  grammarErrorOnNode(name, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -91862,7 +91878,7 @@ var ts;
91862
91878
  var compilerOptions = context.getCompilerOptions();
91863
91879
  var languageVersion = ts.getEmitScriptTarget(compilerOptions);
91864
91880
  var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
91865
- var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 99 /* ESNext */;
91881
+ var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ES2022 */;
91866
91882
  // We don't need to transform `super` property access when targeting ES5, ES3 because
91867
91883
  // the es2015 transformation handles those.
91868
91884
  var shouldTransformSuperInStaticInitializers = (languageVersion <= 8 /* ES2021 */ || !useDefineForClassFields) && languageVersion >= 2 /* ES2015 */;
@@ -91892,7 +91908,7 @@ var ts;
91892
91908
  function transformSourceFile(node) {
91893
91909
  var options = context.getCompilerOptions();
91894
91910
  if (node.isDeclarationFile
91895
- || useDefineForClassFields && ts.getEmitScriptTarget(options) === 99 /* ESNext */) {
91911
+ || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ES2022 */) {
91896
91912
  return node;
91897
91913
  }
91898
91914
  var visited = ts.visitEachChild(node, visitor, context);
@@ -92649,7 +92665,7 @@ var ts;
92649
92665
  if (useDefineForClassFields) {
92650
92666
  // If we are using define semantics and targeting ESNext or higher,
92651
92667
  // then we don't need to transform any class properties.
92652
- return languageVersion < 99 /* ESNext */;
92668
+ return languageVersion < 9 /* ES2022 */;
92653
92669
  }
92654
92670
  return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member);
92655
92671
  }
@@ -123110,13 +123126,6 @@ var ts;
123110
123126
  || ts.isImportSpecifier(parent)
123111
123127
  || ts.isImportClause(parent)
123112
123128
  || ts.isImportEqualsDeclaration(parent) && node === parent.name) {
123113
- var decl = parent;
123114
- while (decl) {
123115
- if (ts.isImportEqualsDeclaration(decl) || ts.isImportClause(decl) || ts.isExportDeclaration(decl)) {
123116
- return decl.isTypeOnly ? 2 /* Type */ : 7 /* All */;
123117
- }
123118
- decl = decl.parent;
123119
- }
123120
123129
  return 7 /* All */;
123121
123130
  }
123122
123131
  else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20211214";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211219";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -19910,7 +19910,7 @@ var ts;
19910
19910
  }
19911
19911
  ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
19912
19912
  function getUseDefineForClassFields(compilerOptions) {
19913
- return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ : compilerOptions.useDefineForClassFields;
19913
+ return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
19914
19914
  }
19915
19915
  ts.getUseDefineForClassFields = getUseDefineForClassFields;
19916
19916
  function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
@@ -33725,7 +33725,7 @@ var ts;
33725
33725
  return true;
33726
33726
  }
33727
33727
  }
33728
- else if (third === 27 /* CommaToken */) {
33728
+ else if (third === 27 /* CommaToken */ || third === 63 /* EqualsToken */) {
33729
33729
  return true;
33730
33730
  }
33731
33731
  return false;
@@ -55591,7 +55591,8 @@ var ts;
55591
55591
  return false;
55592
55592
  }
55593
55593
  function getBaseTypeNodeOfClass(type) {
55594
- return ts.getEffectiveBaseTypeNode(type.symbol.valueDeclaration);
55594
+ var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
55595
+ return decl && ts.getEffectiveBaseTypeNode(decl);
55595
55596
  }
55596
55597
  function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
55597
55598
  var typeArgCount = ts.length(typeArgumentNodes);
@@ -55613,8 +55614,8 @@ var ts;
55613
55614
  */
55614
55615
  function getBaseConstructorTypeOfClass(type) {
55615
55616
  if (!type.resolvedBaseConstructorType) {
55616
- var decl = type.symbol.valueDeclaration;
55617
- var extended = ts.getEffectiveBaseTypeNode(decl);
55617
+ var decl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
55618
+ var extended = decl && ts.getEffectiveBaseTypeNode(decl);
55618
55619
  var baseTypeNode = getBaseTypeNodeOfClass(type);
55619
55620
  if (!baseTypeNode) {
55620
55621
  return type.resolvedBaseConstructorType = undefinedType;
@@ -57619,13 +57620,23 @@ var ts;
57619
57620
  }
57620
57621
  return type;
57621
57622
  }
57623
+ function isMappedTypeGenericIndexedAccess(type) {
57624
+ return type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(type.objectType) & 32 /* Mapped */ &&
57625
+ !isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
57626
+ }
57622
57627
  /**
57623
57628
  * For a type parameter, return the base constraint of the type parameter. For the string, number,
57624
57629
  * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
57625
57630
  * type itself.
57626
57631
  */
57627
57632
  function getApparentType(type) {
57628
- var t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
57633
+ // We obtain the base constraint for all instantiable types, except indexed access types of the form
57634
+ // { [P in K]: E }[X], where K is non-generic and X is generic. For those types, we instead substitute an
57635
+ // instantiation of E where P is replaced with X. We do this because getBaseConstraintOfType directly
57636
+ // lowers to an instantiation where X's constraint is substituted for X, which isn't always desirable.
57637
+ var t = !(type.flags & 465829888 /* Instantiable */) ? type :
57638
+ isMappedTypeGenericIndexedAccess(type) ? substituteIndexedMappedType(type.objectType, type.indexType) :
57639
+ getBaseConstraintOfType(type) || unknownType;
57629
57640
  return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
57630
57641
  t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
57631
57642
  t.flags & 402653316 /* StringLike */ ? globalStringType :
@@ -58241,6 +58252,8 @@ var ts;
58241
58252
  case 205 /* PropertyAccessExpression */:
58242
58253
  case 206 /* ElementAccessExpression */:
58243
58254
  return traverse(node.expression);
58255
+ case 294 /* PropertyAssignment */:
58256
+ return traverse(node.initializer);
58244
58257
  default:
58245
58258
  return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
58246
58259
  }
@@ -66810,12 +66823,14 @@ var ts;
66810
66823
  // not contain anyFunctionType when we come back to this argument for its second round
66811
66824
  // of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
66812
66825
  // when constructing types from type parameters that had no inference candidates).
66813
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === nonInferrableAnyType || source === silentNeverType ||
66814
- (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
66826
+ if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
66815
66827
  return;
66816
66828
  }
66817
66829
  var inference = getInferenceInfoForType(target);
66818
66830
  if (inference) {
66831
+ if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */) {
66832
+ return;
66833
+ }
66819
66834
  if (!inference.isFixed) {
66820
66835
  if (inference.priority === undefined || priority < inference.priority) {
66821
66836
  inference.candidates = undefined;
@@ -66846,21 +66861,19 @@ var ts;
66846
66861
  inferencePriority = Math.min(inferencePriority, priority);
66847
66862
  return;
66848
66863
  }
66849
- else {
66850
- // Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
66851
- var simplified = getSimplifiedType(target, /*writing*/ false);
66852
- if (simplified !== target) {
66853
- invokeOnce(source, simplified, inferFromTypes);
66854
- }
66855
- else if (target.flags & 8388608 /* IndexedAccess */) {
66856
- var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
66857
- // Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
66858
- // that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
66859
- if (indexType.flags & 465829888 /* Instantiable */) {
66860
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
66861
- if (simplified_1 && simplified_1 !== target) {
66862
- invokeOnce(source, simplified_1, inferFromTypes);
66863
- }
66864
+ // Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
66865
+ var simplified = getSimplifiedType(target, /*writing*/ false);
66866
+ if (simplified !== target) {
66867
+ inferFromTypes(source, simplified);
66868
+ }
66869
+ else if (target.flags & 8388608 /* IndexedAccess */) {
66870
+ var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
66871
+ // Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
66872
+ // that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
66873
+ if (indexType.flags & 465829888 /* Instantiable */) {
66874
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
66875
+ if (simplified_1 && simplified_1 !== target) {
66876
+ inferFromTypes(source, simplified_1);
66864
66877
  }
66865
66878
  }
66866
66879
  }
@@ -69730,7 +69743,7 @@ var ts;
69730
69743
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
69731
69744
  someType(type, isGenericTypeWithUnionConstraint) &&
69732
69745
  (isConstraintPosition(type, reference) || hasNonBindingPatternContextualTypeWithNoGenericTypes(reference));
69733
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
69746
+ return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
69734
69747
  }
69735
69748
  function isExportOrExportExpression(location) {
69736
69749
  return !!ts.findAncestor(location, function (n) {
@@ -72701,11 +72714,14 @@ var ts;
72701
72714
  if (!ts.getContainingClass(privId)) {
72702
72715
  return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
72703
72716
  }
72704
- if (!ts.isExpressionNode(privId)) {
72705
- return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
72706
- }
72707
- if (!getSymbolForPrivateIdentifierExpression(privId)) {
72708
- return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
72717
+ if (!ts.isForInStatement(privId.parent)) {
72718
+ if (!ts.isExpressionNode(privId)) {
72719
+ return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
72720
+ }
72721
+ var isInOperation = ts.isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === 101 /* InKeyword */;
72722
+ if (!getSymbolForPrivateIdentifierExpression(privId) && !isInOperation) {
72723
+ return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
72724
+ }
72709
72725
  }
72710
72726
  return false;
72711
72727
  }
@@ -86092,7 +86108,7 @@ var ts;
86092
86108
  if (prop.kind === 295 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
86093
86109
  // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
86094
86110
  // outside of destructuring it is a syntax error
86095
- return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
86111
+ grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
86096
86112
  }
86097
86113
  if (name.kind === 80 /* PrivateIdentifier */) {
86098
86114
  grammarErrorOnNode(name, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -92056,7 +92072,7 @@ var ts;
92056
92072
  var compilerOptions = context.getCompilerOptions();
92057
92073
  var languageVersion = ts.getEmitScriptTarget(compilerOptions);
92058
92074
  var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
92059
- var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 99 /* ESNext */;
92075
+ var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ES2022 */;
92060
92076
  // We don't need to transform `super` property access when targeting ES5, ES3 because
92061
92077
  // the es2015 transformation handles those.
92062
92078
  var shouldTransformSuperInStaticInitializers = (languageVersion <= 8 /* ES2021 */ || !useDefineForClassFields) && languageVersion >= 2 /* ES2015 */;
@@ -92086,7 +92102,7 @@ var ts;
92086
92102
  function transformSourceFile(node) {
92087
92103
  var options = context.getCompilerOptions();
92088
92104
  if (node.isDeclarationFile
92089
- || useDefineForClassFields && ts.getEmitScriptTarget(options) === 99 /* ESNext */) {
92105
+ || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ES2022 */) {
92090
92106
  return node;
92091
92107
  }
92092
92108
  var visited = ts.visitEachChild(node, visitor, context);
@@ -92843,7 +92859,7 @@ var ts;
92843
92859
  if (useDefineForClassFields) {
92844
92860
  // If we are using define semantics and targeting ESNext or higher,
92845
92861
  // then we don't need to transform any class properties.
92846
- return languageVersion < 99 /* ESNext */;
92862
+ return languageVersion < 9 /* ES2022 */;
92847
92863
  }
92848
92864
  return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member);
92849
92865
  }
@@ -123692,13 +123708,6 @@ var ts;
123692
123708
  || ts.isImportSpecifier(parent)
123693
123709
  || ts.isImportClause(parent)
123694
123710
  || ts.isImportEqualsDeclaration(parent) && node === parent.name) {
123695
- var decl = parent;
123696
- while (decl) {
123697
- if (ts.isImportEqualsDeclaration(decl) || ts.isImportClause(decl) || ts.isExportDeclaration(decl)) {
123698
- return decl.isTypeOnly ? 2 /* Type */ : 7 /* All */;
123699
- }
123700
- decl = decl.parent;
123701
- }
123702
123711
  return 7 /* All */;
123703
123712
  }
123704
123713
  else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {