typescript 5.1.0-dev.20230321 → 5.1.0-dev.20230322

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.
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-dev.20230321`;
38
+ version = `${versionMajorMinor}.0-dev.20230322`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7944,6 +7944,7 @@ ${lanes.join("\n")}
7944
7944
  A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),
7945
7945
  A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2847, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2847", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),
7946
7946
  The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."),
7947
+ Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1: diag(2849, 1 /* Error */, "Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1_2849", "Target signature provides too few arguments. Expected {0} or more, but got {1}."),
7947
7948
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
7948
7949
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
7949
7950
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -14322,17 +14323,20 @@ ${lanes.join("\n")}
14322
14323
  function isThisTypePredicate(predicate) {
14323
14324
  return predicate && predicate.kind === 0 /* This */;
14324
14325
  }
14325
- function getPropertyAssignment(objectLiteral, key, key2) {
14326
- return objectLiteral.properties.filter((property) => {
14327
- if (property.kind === 300 /* PropertyAssignment */) {
14328
- const propName = tryGetTextOfPropertyName(property.name);
14329
- return key === propName || !!key2 && key2 === propName;
14330
- }
14331
- return false;
14326
+ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
14327
+ return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
14328
+ if (!isPropertyAssignment(property))
14329
+ return void 0;
14330
+ const propName = tryGetTextOfPropertyName(property.name);
14331
+ return key === propName || key2 && key2 === propName ? callback(property) : void 0;
14332
14332
  });
14333
14333
  }
14334
14334
  function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
14335
- return firstDefined(getPropertyAssignment(objectLiteral, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
14335
+ return forEachPropertyAssignment(
14336
+ objectLiteral,
14337
+ propKey,
14338
+ (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
14339
+ );
14336
14340
  }
14337
14341
  function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
14338
14342
  if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
@@ -14341,11 +14345,10 @@ ${lanes.join("\n")}
14341
14345
  }
14342
14346
  }
14343
14347
  function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
14344
- return firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
14348
+ return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
14345
14349
  }
14346
- function getTsConfigPropArray(tsConfigSourceFile, propKey) {
14347
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile);
14348
- return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray;
14350
+ function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
14351
+ return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
14349
14352
  }
14350
14353
  function getContainingFunction(node) {
14351
14354
  return findAncestor(node.parent, isFunctionLike);
@@ -36253,7 +36256,7 @@ ${lanes.join("\n")}
36253
36256
  if (sourceFile) {
36254
36257
  const fileName = configFileName || "tsconfig.json";
36255
36258
  const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
36256
- const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
36259
+ const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
36257
36260
  const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
36258
36261
  errors.push(error);
36259
36262
  } else {
@@ -47914,7 +47917,7 @@ ${lanes.join("\n")}
47914
47917
  return void 0;
47915
47918
  }
47916
47919
  } else {
47917
- throw Debug.assertNever(name, "Unknown entity name kind.");
47920
+ Debug.assertNever(name, "Unknown entity name kind.");
47918
47921
  }
47919
47922
  Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
47920
47923
  if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 275 /* ExportAssignment */)) {
@@ -55799,7 +55802,7 @@ ${lanes.join("\n")}
55799
55802
  return simplified !== type ? simplified : getConstraintOfType(type);
55800
55803
  }
55801
55804
  function getConstraintFromIndexedAccess(type) {
55802
- if (isMappedTypeGenericIndexedAccess(type)) {
55805
+ if (isMappedTypeGenericIndexedAccess(type) || isGenericMappedType(type.objectType)) {
55803
55806
  return substituteIndexedMappedType(type.objectType, type.indexType);
55804
55807
  }
55805
55808
  const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
@@ -58187,6 +58190,12 @@ ${lanes.join("\n")}
58187
58190
  i--;
58188
58191
  const source = types[i];
58189
58192
  if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
58193
+ if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
58194
+ if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
58195
+ orderedRemoveItemAt(types, i);
58196
+ }
58197
+ continue;
58198
+ }
58190
58199
  const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
58191
58200
  const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
58192
58201
  for (const target of types) {
@@ -58754,7 +58763,7 @@ ${lanes.join("\n")}
58754
58763
  links.resolvedType = getTypeFromTypeNode(node.type);
58755
58764
  break;
58756
58765
  default:
58757
- throw Debug.assertNever(node.operator);
58766
+ Debug.assertNever(node.operator);
58758
58767
  }
58759
58768
  }
58760
58769
  return links.resolvedType;
@@ -59721,7 +59730,10 @@ ${lanes.join("\n")}
59721
59730
  const declarations = concatenate(leftProp.declarations, rightProp.declarations);
59722
59731
  const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
59723
59732
  const result = createSymbol(flags, leftProp.escapedName);
59724
- result.links.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
59733
+ const leftType = getTypeOfSymbol(leftProp);
59734
+ const leftTypeWithoutUndefined = removeMissingOrUndefinedType(leftType);
59735
+ const rightTypeWithoutUndefined = removeMissingOrUndefinedType(rightType);
59736
+ result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], 2 /* Subtype */);
59725
59737
  result.links.leftSpread = leftProp;
59726
59738
  result.links.rightSpread = rightProp;
59727
59739
  result.declarations = declarations;
@@ -61144,6 +61156,9 @@ ${lanes.join("\n")}
61144
61156
  const targetCount = getParameterCount(target);
61145
61157
  const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
61146
61158
  if (sourceHasMoreParameters) {
61159
+ if (reportErrors2 && !(checkMode & 8 /* StrictArity */)) {
61160
+ errorReporter(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount);
61161
+ }
61147
61162
  return 0 /* False */;
61148
61163
  }
61149
61164
  if (source.typeParameters && source.typeParameters !== target.typeParameters) {
@@ -62852,6 +62867,26 @@ ${lanes.join("\n")}
62852
62867
  )) {
62853
62868
  return result2;
62854
62869
  }
62870
+ if (sourceFlags & 8388608 /* IndexedAccess */) {
62871
+ const indexType = source2.indexType;
62872
+ if (indexType.flags & 4194304 /* Index */) {
62873
+ const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
62874
+ const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
62875
+ const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
62876
+ if (result2 = isRelatedTo(
62877
+ constraint2,
62878
+ target2,
62879
+ 1 /* Source */,
62880
+ /*reportErrors*/
62881
+ false,
62882
+ /*headMessage*/
62883
+ void 0,
62884
+ intersectionState
62885
+ )) {
62886
+ return result2;
62887
+ }
62888
+ }
62889
+ }
62855
62890
  if (isMappedTypeGenericIndexedAccess(source2)) {
62856
62891
  const indexConstraint = getConstraintOfType(source2.indexType);
62857
62892
  if (indexConstraint) {
@@ -64043,7 +64078,7 @@ ${lanes.join("\n")}
64043
64078
  return type.symbol;
64044
64079
  }
64045
64080
  if (isTupleType(type)) {
64046
- return type;
64081
+ return type.target;
64047
64082
  }
64048
64083
  }
64049
64084
  if (type.flags & 262144 /* TypeParameter */) {
@@ -65286,21 +65321,19 @@ ${lanes.join("\n")}
65286
65321
  const saveInferencePriority = inferencePriority;
65287
65322
  inferencePriority = 2048 /* MaxValue */;
65288
65323
  const saveExpandingFlags = expandingFlags;
65289
- const sourceIdentity = getRecursionIdentity(source);
65290
- const targetIdentity = getRecursionIdentity(target);
65291
- if (contains(sourceStack, sourceIdentity))
65324
+ (sourceStack != null ? sourceStack : sourceStack = []).push(source);
65325
+ (targetStack != null ? targetStack : targetStack = []).push(target);
65326
+ if (isDeeplyNestedType(source, sourceStack, sourceStack.length, 2))
65292
65327
  expandingFlags |= 1 /* Source */;
65293
- if (contains(targetStack, targetIdentity))
65328
+ if (isDeeplyNestedType(target, targetStack, targetStack.length, 2))
65294
65329
  expandingFlags |= 2 /* Target */;
65295
65330
  if (expandingFlags !== 3 /* Both */) {
65296
- (sourceStack || (sourceStack = [])).push(sourceIdentity);
65297
- (targetStack || (targetStack = [])).push(targetIdentity);
65298
65331
  action(source, target);
65299
- targetStack.pop();
65300
- sourceStack.pop();
65301
65332
  } else {
65302
65333
  inferencePriority = -1 /* Circularity */;
65303
65334
  }
65335
+ targetStack.pop();
65336
+ sourceStack.pop();
65304
65337
  expandingFlags = saveExpandingFlags;
65305
65338
  visited.set(key, inferencePriority);
65306
65339
  inferencePriority = Math.min(inferencePriority, saveInferencePriority);
@@ -73028,7 +73061,7 @@ ${lanes.join("\n")}
73028
73061
  case 283 /* JsxSelfClosingElement */:
73029
73062
  return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
73030
73063
  }
73031
- throw Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
73064
+ Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
73032
73065
  }
73033
73066
  function getResolvedSignature(node, candidatesOutArray, checkMode) {
73034
73067
  const links = getNodeLinks(node);
@@ -84303,7 +84336,7 @@ ${lanes.join("\n")}
84303
84336
  currentKind = 2 /* SetAccessor */;
84304
84337
  break;
84305
84338
  default:
84306
- throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
84339
+ Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
84307
84340
  }
84308
84341
  if (!inDestructuring) {
84309
84342
  const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
@@ -97420,10 +97453,13 @@ ${lanes.join("\n")}
97420
97453
  return Debug.failBadSyntaxKind(node);
97421
97454
  }
97422
97455
  }
97456
+ function hasProto(obj) {
97457
+ return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__"));
97458
+ }
97423
97459
  function hasKeyAfterPropsSpread(node) {
97424
97460
  let spread = false;
97425
97461
  for (const elem of node.attributes.properties) {
97426
- if (isJsxSpreadAttribute(elem)) {
97462
+ if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) {
97427
97463
  spread = true;
97428
97464
  } else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") {
97429
97465
  return true;
@@ -97589,7 +97625,10 @@ ${lanes.join("\n")}
97589
97625
  }
97590
97626
  return element;
97591
97627
  }
97592
- function transformJsxSpreadAttributeToSpreadAssignment(node) {
97628
+ function transformJsxSpreadAttributeToProps(node) {
97629
+ if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) {
97630
+ return node.expression.properties;
97631
+ }
97593
97632
  return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
97594
97633
  }
97595
97634
  function transformJsxAttributesToObjectProps(attrs, children) {
@@ -97597,30 +97636,48 @@ ${lanes.join("\n")}
97597
97636
  return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children);
97598
97637
  }
97599
97638
  function transformJsxAttributesToProps(attrs, children) {
97600
- const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToSpreadAssignment(attr) : transformJsxAttributeToObjectLiteralElement(attr))));
97639
+ const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr)))));
97601
97640
  if (children) {
97602
97641
  props.push(children);
97603
97642
  }
97604
97643
  return props;
97605
97644
  }
97606
97645
  function transformJsxAttributesToExpression(attrs, children) {
97607
- const expressions = flatten(
97608
- spanMap(
97609
- attrs,
97610
- isJsxSpreadAttribute,
97611
- (attrs2, isSpread) => isSpread ? map(attrs2, transformJsxSpreadAttributeToExpression) : factory2.createObjectLiteralExpression(map(attrs2, transformJsxAttributeToObjectLiteralElement))
97612
- )
97613
- );
97614
- if (isJsxSpreadAttribute(attrs[0])) {
97615
- expressions.unshift(factory2.createObjectLiteralExpression());
97646
+ const expressions = [];
97647
+ let properties = [];
97648
+ for (const attr of attrs) {
97649
+ if (isJsxSpreadAttribute(attr)) {
97650
+ if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) {
97651
+ for (const prop of attr.expression.properties) {
97652
+ if (isSpreadAssignment(prop)) {
97653
+ finishObjectLiteralIfNeeded();
97654
+ expressions.push(prop.expression);
97655
+ continue;
97656
+ }
97657
+ properties.push(prop);
97658
+ }
97659
+ continue;
97660
+ }
97661
+ finishObjectLiteralIfNeeded();
97662
+ expressions.push(attr.expression);
97663
+ continue;
97664
+ }
97665
+ properties.push(transformJsxAttributeToObjectLiteralElement(attr));
97616
97666
  }
97617
97667
  if (children) {
97618
- expressions.push(factory2.createObjectLiteralExpression([children]));
97668
+ properties.push(children);
97669
+ }
97670
+ finishObjectLiteralIfNeeded();
97671
+ if (expressions.length && !isObjectLiteralExpression(expressions[0])) {
97672
+ expressions.unshift(factory2.createObjectLiteralExpression());
97619
97673
  }
97620
97674
  return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
97621
- }
97622
- function transformJsxSpreadAttributeToExpression(node) {
97623
- return Debug.checkDefined(visitNode(node.expression, visitor, isExpression));
97675
+ function finishObjectLiteralIfNeeded() {
97676
+ if (properties.length) {
97677
+ expressions.push(factory2.createObjectLiteralExpression(properties));
97678
+ properties = [];
97679
+ }
97680
+ }
97624
97681
  }
97625
97682
  function transformJsxAttributeToObjectLiteralElement(node) {
97626
97683
  const name = getAttributeName(node);
@@ -118495,8 +118552,9 @@ ${lanes.join("\n")}
118495
118552
  if (!referenceInfo)
118496
118553
  return void 0;
118497
118554
  const { sourceFile, index } = referenceInfo;
118498
- const referencesSyntax = firstDefined(
118499
- getTsConfigPropArray(sourceFile, "references"),
118555
+ const referencesSyntax = forEachTsConfigPropArray(
118556
+ sourceFile,
118557
+ "references",
118500
118558
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
118501
118559
  );
118502
118560
  return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
@@ -118567,26 +118625,24 @@ ${lanes.join("\n")}
118567
118625
  }
118568
118626
  function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
118569
118627
  let needCompilerDiagnostic = true;
118570
- const pathsSyntax = getOptionPathsSyntax();
118571
- for (const pathProp of pathsSyntax) {
118628
+ forEachOptionPathsSyntax((pathProp) => {
118572
118629
  if (isObjectLiteralExpression(pathProp.initializer)) {
118573
- for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
118630
+ forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
118574
118631
  const initializer = keyProps.initializer;
118575
118632
  if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
118576
118633
  programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
118577
118634
  needCompilerDiagnostic = false;
118578
118635
  }
118579
- }
118636
+ });
118580
118637
  }
118581
- }
118638
+ });
118582
118639
  if (needCompilerDiagnostic) {
118583
118640
  programDiagnostics.add(createCompilerDiagnostic(message, ...args));
118584
118641
  }
118585
118642
  }
118586
118643
  function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
118587
118644
  let needCompilerDiagnostic = true;
118588
- const pathsSyntax = getOptionPathsSyntax();
118589
- for (const pathProp of pathsSyntax) {
118645
+ forEachOptionPathsSyntax((pathProp) => {
118590
118646
  if (isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax(
118591
118647
  pathProp.initializer,
118592
118648
  onKey,
@@ -118598,21 +118654,19 @@ ${lanes.join("\n")}
118598
118654
  )) {
118599
118655
  needCompilerDiagnostic = false;
118600
118656
  }
118601
- }
118657
+ });
118602
118658
  if (needCompilerDiagnostic) {
118603
118659
  programDiagnostics.add(createCompilerDiagnostic(message, ...args));
118604
118660
  }
118605
118661
  }
118606
- function getOptionsSyntaxByName(name) {
118607
- const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
118608
- return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name);
118662
+ function forEachOptionsSyntaxByName(name, callback) {
118663
+ return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
118609
118664
  }
118610
- function getOptionPathsSyntax() {
118611
- return getOptionsSyntaxByName("paths") || emptyArray;
118665
+ function forEachOptionPathsSyntax(callback) {
118666
+ return forEachOptionsSyntaxByName("paths", callback);
118612
118667
  }
118613
118668
  function getOptionsSyntaxByValue(name, value) {
118614
- const syntaxByName = getOptionsSyntaxByName(name);
118615
- return syntaxByName && firstDefined(syntaxByName, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
118669
+ return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
118616
118670
  }
118617
118671
  function getOptionsSyntaxByArrayElementValue(name, value) {
118618
118672
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -118642,8 +118696,9 @@ ${lanes.join("\n")}
118642
118696
  );
118643
118697
  }
118644
118698
  function createDiagnosticForReference(sourceFile, index, message, ...args) {
118645
- const referencesSyntax = firstDefined(
118646
- getTsConfigPropArray(sourceFile || options.configFile, "references"),
118699
+ const referencesSyntax = forEachTsConfigPropArray(
118700
+ sourceFile || options.configFile,
118701
+ "references",
118647
118702
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
118648
118703
  );
118649
118704
  if (referencesSyntax && referencesSyntax.elements.length > index) {
@@ -118665,29 +118720,25 @@ ${lanes.join("\n")}
118665
118720
  }
118666
118721
  function getCompilerOptionsObjectLiteralSyntax() {
118667
118722
  if (_compilerOptionsObjectLiteralSyntax === void 0) {
118668
- _compilerOptionsObjectLiteralSyntax = false;
118669
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(options.configFile);
118670
- if (jsonObjectLiteral) {
118671
- for (const prop of getPropertyAssignment(jsonObjectLiteral, "compilerOptions")) {
118672
- if (isObjectLiteralExpression(prop.initializer)) {
118673
- _compilerOptionsObjectLiteralSyntax = prop.initializer;
118674
- break;
118675
- }
118676
- }
118677
- }
118723
+ _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
118724
+ getTsConfigObjectLiteralExpression(options.configFile),
118725
+ "compilerOptions",
118726
+ (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
118727
+ ) || false;
118678
118728
  }
118679
118729
  return _compilerOptionsObjectLiteralSyntax || void 0;
118680
118730
  }
118681
118731
  function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
118682
- const props = getPropertyAssignment(objectLiteral, key1, key2);
118683
- for (const prop of props) {
118732
+ let needsCompilerDiagnostic = false;
118733
+ forEachPropertyAssignment(objectLiteral, key1, (prop) => {
118684
118734
  if ("messageText" in message) {
118685
118735
  programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
118686
118736
  } else {
118687
118737
  programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
118688
118738
  }
118689
- }
118690
- return !!props.length;
118739
+ needsCompilerDiagnostic = true;
118740
+ }, key2);
118741
+ return needsCompilerDiagnostic;
118691
118742
  }
118692
118743
  function createRedundantOptionDiagnostic(errorOnOption, redundantWithOption) {
118693
118744
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -125431,7 +125482,7 @@ ${lanes.join("\n")}
125431
125482
  case 0 /* Ok */:
125432
125483
  return Debug.fail();
125433
125484
  default:
125434
- throw Debug.assertNever(result);
125485
+ Debug.assertNever(result);
125435
125486
  }
125436
125487
  }
125437
125488
  var unprefixedNodeCoreModuleList, prefixedNodeCoreModuleList, nodeCoreModuleList, nodeCoreModules, NameValidationResult, maxPackageNameLength;
@@ -128633,6 +128684,7 @@ ${lanes.join("\n")}
128633
128684
  147 /* ReadonlyKeyword */,
128634
128685
  153 /* StringKeyword */,
128635
128686
  154 /* SymbolKeyword */,
128687
+ 113 /* TypeOfKeyword */,
128636
128688
  111 /* TrueKeyword */,
128637
128689
  115 /* VoidKeyword */,
128638
128690
  156 /* UndefinedKeyword */,
@@ -146930,7 +146982,7 @@ ${lanes.join("\n")}
146930
146982
  /*checkArgumentIsStringLiteralLike*/
146931
146983
  true
146932
146984
  )) {
146933
- throw Debug.failBadSyntaxKind(parent2);
146985
+ Debug.failBadSyntaxKind(parent2);
146934
146986
  }
146935
146987
  const decl = cast(parent2.parent, isVariableDeclaration);
146936
146988
  const defaultImportName = tryCast(decl.name, isIdentifier);
@@ -150396,7 +150448,7 @@ ${lanes.join("\n")}
150396
150448
  return true;
150397
150449
  }
150398
150450
  }
150399
- return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !(isClassLike(contextToken2.parent) && (contextToken2 !== previousToken || position > previousToken.end));
150451
+ return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
150400
150452
  }
150401
150453
  function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
150402
150454
  return contextToken2.kind !== 63 /* EqualsToken */ && (contextToken2.kind === 26 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
@@ -160546,7 +160598,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160546
160598
  case 176 /* SetAccessor */:
160547
160599
  return `'set ${scope.name.getText()}'`;
160548
160600
  default:
160549
- throw Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
160601
+ Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
160550
160602
  }
160551
160603
  }
160552
160604
  function getDescriptionForClassLikeDeclaration(scope) {
@@ -179169,10 +179221,12 @@ ${e.message}`;
179169
179221
  forEachKey: () => forEachKey,
179170
179222
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
179171
179223
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
179224
+ forEachPropertyAssignment: () => forEachPropertyAssignment,
179172
179225
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
179173
179226
  forEachReturnStatement: () => forEachReturnStatement,
179174
179227
  forEachRight: () => forEachRight,
179175
179228
  forEachTrailingCommentRange: () => forEachTrailingCommentRange,
179229
+ forEachTsConfigPropArray: () => forEachTsConfigPropArray,
179176
179230
  forEachUnique: () => forEachUnique,
179177
179231
  forEachYieldExpression: () => forEachYieldExpression,
179178
179232
  forSomeAncestorDirectory: () => forSomeAncestorDirectory,
@@ -179505,7 +179559,6 @@ ${e.message}`;
179505
179559
  getProperties: () => getProperties,
179506
179560
  getProperty: () => getProperty,
179507
179561
  getPropertyArrayElementValue: () => getPropertyArrayElementValue,
179508
- getPropertyAssignment: () => getPropertyAssignment,
179509
179562
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
179510
179563
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
179511
179564
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
@@ -179610,7 +179663,6 @@ ${e.message}`;
179610
179663
  getTransformers: () => getTransformers,
179611
179664
  getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
179612
179665
  getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
179613
- getTsConfigPropArray: () => getTsConfigPropArray,
179614
179666
  getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
179615
179667
  getTypeAnnotationNode: () => getTypeAnnotationNode,
179616
179668
  getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
@@ -181528,10 +181580,12 @@ ${e.message}`;
181528
181580
  forEachKey: () => forEachKey,
181529
181581
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
181530
181582
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
181583
+ forEachPropertyAssignment: () => forEachPropertyAssignment,
181531
181584
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
181532
181585
  forEachReturnStatement: () => forEachReturnStatement,
181533
181586
  forEachRight: () => forEachRight,
181534
181587
  forEachTrailingCommentRange: () => forEachTrailingCommentRange,
181588
+ forEachTsConfigPropArray: () => forEachTsConfigPropArray,
181535
181589
  forEachUnique: () => forEachUnique,
181536
181590
  forEachYieldExpression: () => forEachYieldExpression,
181537
181591
  forSomeAncestorDirectory: () => forSomeAncestorDirectory,
@@ -181864,7 +181918,6 @@ ${e.message}`;
181864
181918
  getProperties: () => getProperties,
181865
181919
  getProperty: () => getProperty,
181866
181920
  getPropertyArrayElementValue: () => getPropertyArrayElementValue,
181867
- getPropertyAssignment: () => getPropertyAssignment,
181868
181921
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
181869
181922
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
181870
181923
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
@@ -181969,7 +182022,6 @@ ${e.message}`;
181969
182022
  getTransformers: () => getTransformers,
181970
182023
  getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
181971
182024
  getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
181972
- getTsConfigPropArray: () => getTsConfigPropArray,
181973
182025
  getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
181974
182026
  getTypeAnnotationNode: () => getTypeAnnotationNode,
181975
182027
  getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,