@typescript-deploys/pr-build 5.1.0-pr-50951-7 → 5.1.0-pr-53413-14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.1";
21
- var version = `${versionMajorMinor}.0-insiders.20230320`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230321`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6634,6 +6634,7 @@ var Diagnostics = {
6634
6634
  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?"),
6635
6635
  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."),
6636
6636
  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."),
6637
+ 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}."),
6637
6638
  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}'."),
6638
6639
  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}'."),
6639
6640
  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}'."),
@@ -10242,36 +10243,32 @@ function getModifiers(node) {
10242
10243
  return filter(node.modifiers, isModifier);
10243
10244
  }
10244
10245
  }
10245
- function getJSDocParameterTagsWorker(node, noCache) {
10246
- const declaration = getRootDeclaration(node);
10247
- if (isParameter(declaration)) {
10248
- const name = isBindingElement(node) ? node.propertyName || node.name : node.name;
10249
- const signatureDeclaration = declaration.parent;
10250
- const jsDocParameterTags = filter(getJSDocTagsWorker(signatureDeclaration, noCache), isJSDocParameterTag);
10251
- if (length(jsDocParameterTags) === 0) {
10252
- return emptyArray;
10253
- }
10254
- if (isIdentifier(name)) {
10255
- return filter(jsDocParameterTags, (tag) => isIdentifier(tag.name) && tag.name.escapedText === name.escapedText);
10256
- }
10257
- const i = signatureDeclaration.parameters.indexOf(declaration);
10258
- Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
10259
- if (i < length(jsDocParameterTags)) {
10260
- return [jsDocParameterTags[i]];
10246
+ function getJSDocParameterTagsWorker(param, noCache) {
10247
+ if (param.name) {
10248
+ if (isIdentifier(param.name)) {
10249
+ const name = param.name.escapedText;
10250
+ return getJSDocTagsWorker(param.parent, noCache).filter((tag) => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name);
10251
+ } else {
10252
+ const i = param.parent.parameters.indexOf(param);
10253
+ Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
10254
+ const paramTags = getJSDocTagsWorker(param.parent, noCache).filter(isJSDocParameterTag);
10255
+ if (i < paramTags.length) {
10256
+ return [paramTags[i]];
10257
+ }
10261
10258
  }
10262
10259
  }
10263
10260
  return emptyArray;
10264
10261
  }
10265
- function getJSDocParameterTags(node) {
10262
+ function getJSDocParameterTags(param) {
10266
10263
  return getJSDocParameterTagsWorker(
10267
- node,
10264
+ param,
10268
10265
  /*noCache*/
10269
10266
  false
10270
10267
  );
10271
10268
  }
10272
- function getJSDocParameterTagsNoCache(node) {
10269
+ function getJSDocParameterTagsNoCache(param) {
10273
10270
  return getJSDocParameterTagsWorker(
10274
- node,
10271
+ param,
10275
10272
  /*noCache*/
10276
10273
  true
10277
10274
  );
@@ -10378,7 +10375,7 @@ function getJSDocTypeTag(node) {
10378
10375
  }
10379
10376
  function getJSDocType(node) {
10380
10377
  let tag = getFirstJSDocTag(node, isJSDocTypeTag);
10381
- if (!tag && (isParameter(node) || isBindingElement(node))) {
10378
+ if (!tag && isParameter(node)) {
10382
10379
  tag = find(getJSDocParameterTags(node), (tag2) => !!tag2.typeExpression);
10383
10380
  }
10384
10381
  return tag && tag.typeExpression && tag.typeExpression.type;
@@ -12715,17 +12712,20 @@ function isObjectLiteralOrClassExpressionMethodOrAccessor(node) {
12715
12712
  function isIdentifierTypePredicate(predicate) {
12716
12713
  return predicate && predicate.kind === 1 /* Identifier */;
12717
12714
  }
12718
- function getPropertyAssignment(objectLiteral, key, key2) {
12719
- return objectLiteral.properties.filter((property) => {
12720
- if (property.kind === 300 /* PropertyAssignment */) {
12721
- const propName = tryGetTextOfPropertyName(property.name);
12722
- return key === propName || !!key2 && key2 === propName;
12723
- }
12724
- return false;
12715
+ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
12716
+ return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
12717
+ if (!isPropertyAssignment(property))
12718
+ return void 0;
12719
+ const propName = tryGetTextOfPropertyName(property.name);
12720
+ return key === propName || key2 && key2 === propName ? callback(property) : void 0;
12725
12721
  });
12726
12722
  }
12727
12723
  function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
12728
- return firstDefined(getPropertyAssignment(objectLiteral, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
12724
+ return forEachPropertyAssignment(
12725
+ objectLiteral,
12726
+ propKey,
12727
+ (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
12728
+ );
12729
12729
  }
12730
12730
  function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
12731
12731
  if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
@@ -12734,11 +12734,10 @@ function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
12734
12734
  }
12735
12735
  }
12736
12736
  function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
12737
- return firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
12737
+ return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
12738
12738
  }
12739
- function getTsConfigPropArray(tsConfigSourceFile, propKey) {
12740
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile);
12741
- return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray;
12739
+ function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
12740
+ return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
12742
12741
  }
12743
12742
  function getContainingFunction(node) {
12744
12743
  return findAncestor(node.parent, isFunctionLike);
@@ -13699,7 +13698,7 @@ function getJSDocCommentsAndTags(hostNode, noCache) {
13699
13698
  if (hasJSDocNodes(node)) {
13700
13699
  result = addRange(result, filterOwnedJSDocTags(hostNode, last(node.jsDoc)));
13701
13700
  }
13702
- if (node.kind === 167 /* Parameter */ || node.kind === 206 /* BindingElement */) {
13701
+ if (node.kind === 167 /* Parameter */) {
13703
13702
  result = addRange(result, (noCache ? getJSDocParameterTagsNoCache : getJSDocParameterTags)(node));
13704
13703
  break;
13705
13704
  }
@@ -35500,7 +35499,7 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
35500
35499
  if (sourceFile) {
35501
35500
  const fileName = configFileName || "tsconfig.json";
35502
35501
  const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
35503
- const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
35502
+ const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
35504
35503
  const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
35505
35504
  errors.push(error);
35506
35505
  } else {
@@ -47196,8 +47195,11 @@ function createTypeChecker(host) {
47196
47195
  }
47197
47196
  return typeToTypeNodeHelper(type2, context);
47198
47197
  }
47198
+ function isMappedTypeHomomorphic(type2) {
47199
+ return !!getHomomorphicTypeVariable(type2);
47200
+ }
47199
47201
  function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) {
47200
- return isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 262144 /* TypeParameter */);
47202
+ return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
47201
47203
  }
47202
47204
  function createMappedTypeNodeFromType(type2) {
47203
47205
  Debug.assert(!!(type2.flags & 524288 /* Object */));
@@ -50647,12 +50649,6 @@ function createTypeChecker(host) {
50647
50649
  }
50648
50650
  function getTypeForBindingElement(declaration) {
50649
50651
  const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
50650
- if (isInJSFile(declaration) && isParameterDeclaration(declaration)) {
50651
- const type = tryGetTypeFromEffectiveTypeNode(declaration);
50652
- if (type) {
50653
- return type;
50654
- }
50655
- }
50656
50652
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
50657
50653
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
50658
50654
  }
@@ -53371,7 +53367,7 @@ function createTypeChecker(host) {
53371
53367
  return simplified !== type ? simplified : getConstraintOfType(type);
53372
53368
  }
53373
53369
  function getConstraintFromIndexedAccess(type) {
53374
- if (isMappedTypeGenericIndexedAccess(type)) {
53370
+ if (isMappedTypeGenericIndexedAccess(type) || isGenericMappedType(type.objectType)) {
53375
53371
  return substituteIndexedMappedType(type.objectType, type.indexType);
53376
53372
  }
53377
53373
  const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
@@ -55759,6 +55755,12 @@ function createTypeChecker(host) {
55759
55755
  i--;
55760
55756
  const source = types[i];
55761
55757
  if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
55758
+ if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
55759
+ if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
55760
+ orderedRemoveItemAt(types, i);
55761
+ }
55762
+ continue;
55763
+ }
55762
55764
  const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
55763
55765
  const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
55764
55766
  for (const target of types) {
@@ -57293,7 +57295,10 @@ function createTypeChecker(host) {
57293
57295
  const declarations = concatenate(leftProp.declarations, rightProp.declarations);
57294
57296
  const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */;
57295
57297
  const result = createSymbol(flags, leftProp.escapedName);
57296
- result.links.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */);
57298
+ const leftType = getTypeOfSymbol(leftProp);
57299
+ const leftTypeWithoutUndefined = removeMissingOrUndefinedType(leftType);
57300
+ const rightTypeWithoutUndefined = removeMissingOrUndefinedType(rightType);
57301
+ result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], 2 /* Subtype */);
57297
57302
  result.links.leftSpread = leftProp;
57298
57303
  result.links.rightSpread = rightProp;
57299
57304
  result.declarations = declarations;
@@ -58716,6 +58721,9 @@ function createTypeChecker(host) {
58716
58721
  const targetCount = getParameterCount(target);
58717
58722
  const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
58718
58723
  if (sourceHasMoreParameters) {
58724
+ if (reportErrors2 && !(checkMode & 8 /* StrictArity */)) {
58725
+ errorReporter(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount);
58726
+ }
58719
58727
  return 0 /* False */;
58720
58728
  }
58721
58729
  if (source.typeParameters && source.typeParameters !== target.typeParameters) {
@@ -60424,6 +60432,26 @@ function createTypeChecker(host) {
60424
60432
  )) {
60425
60433
  return result2;
60426
60434
  }
60435
+ if (sourceFlags & 8388608 /* IndexedAccess */) {
60436
+ const indexType = source2.indexType;
60437
+ if (indexType.flags & 4194304 /* Index */) {
60438
+ const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type);
60439
+ const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType;
60440
+ const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint);
60441
+ if (result2 = isRelatedTo(
60442
+ constraint2,
60443
+ target2,
60444
+ 1 /* Source */,
60445
+ /*reportErrors*/
60446
+ false,
60447
+ /*headMessage*/
60448
+ void 0,
60449
+ intersectionState
60450
+ )) {
60451
+ return result2;
60452
+ }
60453
+ }
60454
+ }
60427
60455
  if (isMappedTypeGenericIndexedAccess(source2)) {
60428
60456
  const indexConstraint = getConstraintOfType(source2.indexType);
60429
60457
  if (indexConstraint) {
@@ -61615,7 +61643,7 @@ function createTypeChecker(host) {
61615
61643
  return type.symbol;
61616
61644
  }
61617
61645
  if (isTupleType(type)) {
61618
- return type;
61646
+ return type.target;
61619
61647
  }
61620
61648
  }
61621
61649
  if (type.flags & 262144 /* TypeParameter */) {
@@ -62858,21 +62886,19 @@ function createTypeChecker(host) {
62858
62886
  const saveInferencePriority = inferencePriority;
62859
62887
  inferencePriority = 2048 /* MaxValue */;
62860
62888
  const saveExpandingFlags = expandingFlags;
62861
- const sourceIdentity = getRecursionIdentity(source);
62862
- const targetIdentity = getRecursionIdentity(target);
62863
- if (contains(sourceStack, sourceIdentity))
62889
+ (sourceStack != null ? sourceStack : sourceStack = []).push(source);
62890
+ (targetStack != null ? targetStack : targetStack = []).push(target);
62891
+ if (isDeeplyNestedType(source, sourceStack, sourceStack.length, 2))
62864
62892
  expandingFlags |= 1 /* Source */;
62865
- if (contains(targetStack, targetIdentity))
62893
+ if (isDeeplyNestedType(target, targetStack, targetStack.length, 2))
62866
62894
  expandingFlags |= 2 /* Target */;
62867
62895
  if (expandingFlags !== 3 /* Both */) {
62868
- (sourceStack || (sourceStack = [])).push(sourceIdentity);
62869
- (targetStack || (targetStack = [])).push(targetIdentity);
62870
62896
  action(source, target);
62871
- targetStack.pop();
62872
- sourceStack.pop();
62873
62897
  } else {
62874
62898
  inferencePriority = -1 /* Circularity */;
62875
62899
  }
62900
+ targetStack.pop();
62901
+ sourceStack.pop();
62876
62902
  expandingFlags = saveExpandingFlags;
62877
62903
  visited.set(key, inferencePriority);
62878
62904
  inferencePriority = Math.min(inferencePriority, saveInferencePriority);
@@ -115624,8 +115650,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115624
115650
  if (!referenceInfo)
115625
115651
  return void 0;
115626
115652
  const { sourceFile, index } = referenceInfo;
115627
- const referencesSyntax = firstDefined(
115628
- getTsConfigPropArray(sourceFile, "references"),
115653
+ const referencesSyntax = forEachTsConfigPropArray(
115654
+ sourceFile,
115655
+ "references",
115629
115656
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
115630
115657
  );
115631
115658
  return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
@@ -115696,26 +115723,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115696
115723
  }
115697
115724
  function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
115698
115725
  let needCompilerDiagnostic = true;
115699
- const pathsSyntax = getOptionPathsSyntax();
115700
- for (const pathProp of pathsSyntax) {
115726
+ forEachOptionPathsSyntax((pathProp) => {
115701
115727
  if (isObjectLiteralExpression(pathProp.initializer)) {
115702
- for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
115728
+ forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
115703
115729
  const initializer = keyProps.initializer;
115704
115730
  if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
115705
115731
  programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
115706
115732
  needCompilerDiagnostic = false;
115707
115733
  }
115708
- }
115734
+ });
115709
115735
  }
115710
- }
115736
+ });
115711
115737
  if (needCompilerDiagnostic) {
115712
115738
  programDiagnostics.add(createCompilerDiagnostic(message, ...args));
115713
115739
  }
115714
115740
  }
115715
115741
  function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
115716
115742
  let needCompilerDiagnostic = true;
115717
- const pathsSyntax = getOptionPathsSyntax();
115718
- for (const pathProp of pathsSyntax) {
115743
+ forEachOptionPathsSyntax((pathProp) => {
115719
115744
  if (isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax(
115720
115745
  pathProp.initializer,
115721
115746
  onKey,
@@ -115727,21 +115752,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115727
115752
  )) {
115728
115753
  needCompilerDiagnostic = false;
115729
115754
  }
115730
- }
115755
+ });
115731
115756
  if (needCompilerDiagnostic) {
115732
115757
  programDiagnostics.add(createCompilerDiagnostic(message, ...args));
115733
115758
  }
115734
115759
  }
115735
- function getOptionsSyntaxByName(name) {
115736
- const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
115737
- return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name);
115760
+ function forEachOptionsSyntaxByName(name, callback) {
115761
+ return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
115738
115762
  }
115739
- function getOptionPathsSyntax() {
115740
- return getOptionsSyntaxByName("paths") || emptyArray;
115763
+ function forEachOptionPathsSyntax(callback) {
115764
+ return forEachOptionsSyntaxByName("paths", callback);
115741
115765
  }
115742
115766
  function getOptionsSyntaxByValue(name, value) {
115743
- const syntaxByName = getOptionsSyntaxByName(name);
115744
- return syntaxByName && firstDefined(syntaxByName, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
115767
+ return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
115745
115768
  }
115746
115769
  function getOptionsSyntaxByArrayElementValue(name, value) {
115747
115770
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
@@ -115771,8 +115794,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115771
115794
  );
115772
115795
  }
115773
115796
  function createDiagnosticForReference(sourceFile, index, message, ...args) {
115774
- const referencesSyntax = firstDefined(
115775
- getTsConfigPropArray(sourceFile || options.configFile, "references"),
115797
+ const referencesSyntax = forEachTsConfigPropArray(
115798
+ sourceFile || options.configFile,
115799
+ "references",
115776
115800
  (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
115777
115801
  );
115778
115802
  if (referencesSyntax && referencesSyntax.elements.length > index) {
@@ -115794,29 +115818,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115794
115818
  }
115795
115819
  function getCompilerOptionsObjectLiteralSyntax() {
115796
115820
  if (_compilerOptionsObjectLiteralSyntax === void 0) {
115797
- _compilerOptionsObjectLiteralSyntax = false;
115798
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(options.configFile);
115799
- if (jsonObjectLiteral) {
115800
- for (const prop of getPropertyAssignment(jsonObjectLiteral, "compilerOptions")) {
115801
- if (isObjectLiteralExpression(prop.initializer)) {
115802
- _compilerOptionsObjectLiteralSyntax = prop.initializer;
115803
- break;
115804
- }
115805
- }
115806
- }
115821
+ _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
115822
+ getTsConfigObjectLiteralExpression(options.configFile),
115823
+ "compilerOptions",
115824
+ (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
115825
+ ) || false;
115807
115826
  }
115808
115827
  return _compilerOptionsObjectLiteralSyntax || void 0;
115809
115828
  }
115810
115829
  function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
115811
- const props = getPropertyAssignment(objectLiteral, key1, key2);
115812
- for (const prop of props) {
115830
+ let needsCompilerDiagnostic = false;
115831
+ forEachPropertyAssignment(objectLiteral, key1, (prop) => {
115813
115832
  if ("messageText" in message) {
115814
115833
  programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
115815
115834
  } else {
115816
115835
  programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
115817
115836
  }
115818
- }
115819
- return !!props.length;
115837
+ needsCompilerDiagnostic = true;
115838
+ }, key2);
115839
+ return needsCompilerDiagnostic;
115820
115840
  }
115821
115841
  function createRedundantOptionDiagnostic(errorOnOption, redundantWithOption) {
115822
115842
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();