typescript 4.6.0-dev.20211213 → 4.6.0-dev.20211218

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.
@@ -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.20211213";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211218";
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
  }
@@ -65896,7 +65909,7 @@ var ts;
65896
65909
  // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
65897
65910
  // no flags for all other types (including non-falsy literal types).
65898
65911
  function getFalsyFlags(type) {
65899
- return type.flags & 3145728 /* UnionOrIntersection */ ? getFalsyFlagsOfTypes(type.types) :
65912
+ return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
65900
65913
  type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
65901
65914
  type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
65902
65915
  type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
@@ -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
  }
@@ -82719,7 +82735,7 @@ var ts;
82719
82735
  if (memberSymbol) {
82720
82736
  var declaration = memberSymbol.valueDeclaration;
82721
82737
  if (declaration !== member) {
82722
- if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member)) {
82738
+ if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member) && ts.isEnumDeclaration(declaration.parent)) {
82723
82739
  return getEnumMemberValue(declaration);
82724
82740
  }
82725
82741
  error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
@@ -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)) {
@@ -157683,11 +157692,12 @@ var ts;
157683
157692
  var result = [];
157684
157693
  return visitor(selection) ? undefined : result;
157685
157694
  function visitor(node) {
157695
+ var _a;
157686
157696
  if (ts.isTypeReferenceNode(node)) {
157687
157697
  if (ts.isIdentifier(node.typeName)) {
157688
157698
  var symbol = checker.resolveName(node.typeName.text, node.typeName, 262144 /* TypeParameter */, /* excludeGlobals */ true);
157689
- if (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) {
157690
- var declaration = ts.cast(ts.first(symbol.declarations), ts.isTypeParameterDeclaration);
157699
+ var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0], ts.isTypeParameterDeclaration);
157700
+ if (declaration) {
157691
157701
  if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) {
157692
157702
  ts.pushIfUnique(result, declaration);
157693
157703
  }
package/lib/typescript.js CHANGED
@@ -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.20211213";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211218";
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
  }
@@ -65896,7 +65909,7 @@ var ts;
65896
65909
  // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
65897
65910
  // no flags for all other types (including non-falsy literal types).
65898
65911
  function getFalsyFlags(type) {
65899
- return type.flags & 3145728 /* UnionOrIntersection */ ? getFalsyFlagsOfTypes(type.types) :
65912
+ return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
65900
65913
  type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
65901
65914
  type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
65902
65915
  type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
@@ -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
  }
@@ -82719,7 +82735,7 @@ var ts;
82719
82735
  if (memberSymbol) {
82720
82736
  var declaration = memberSymbol.valueDeclaration;
82721
82737
  if (declaration !== member) {
82722
- if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member)) {
82738
+ if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member) && ts.isEnumDeclaration(declaration.parent)) {
82723
82739
  return getEnumMemberValue(declaration);
82724
82740
  }
82725
82741
  error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
@@ -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)) {
@@ -157683,11 +157692,12 @@ var ts;
157683
157692
  var result = [];
157684
157693
  return visitor(selection) ? undefined : result;
157685
157694
  function visitor(node) {
157695
+ var _a;
157686
157696
  if (ts.isTypeReferenceNode(node)) {
157687
157697
  if (ts.isIdentifier(node.typeName)) {
157688
157698
  var symbol = checker.resolveName(node.typeName.text, node.typeName, 262144 /* TypeParameter */, /* excludeGlobals */ true);
157689
- if (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) {
157690
- var declaration = ts.cast(ts.first(symbol.declarations), ts.isTypeParameterDeclaration);
157699
+ var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0], ts.isTypeParameterDeclaration);
157700
+ if (declaration) {
157691
157701
  if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) {
157692
157702
  ts.pushIfUnique(result, declaration);
157693
157703
  }