typescript 5.1.0-dev.20230321 → 5.1.0-dev.20230323

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/typescript.js CHANGED
@@ -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.20230323`;
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}'."),
@@ -14158,9 +14159,8 @@ ${lanes.join("\n")}
14158
14159
  return node === parent2.type;
14159
14160
  case 211 /* CallExpression */:
14160
14161
  case 212 /* NewExpression */:
14161
- return contains(parent2.typeArguments, node);
14162
14162
  case 213 /* TaggedTemplateExpression */:
14163
- return false;
14163
+ return contains(parent2.typeArguments, node);
14164
14164
  }
14165
14165
  }
14166
14166
  }
@@ -14322,17 +14322,20 @@ ${lanes.join("\n")}
14322
14322
  function isThisTypePredicate(predicate) {
14323
14323
  return predicate && predicate.kind === 0 /* This */;
14324
14324
  }
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;
14325
+ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
14326
+ return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
14327
+ if (!isPropertyAssignment(property))
14328
+ return void 0;
14329
+ const propName = tryGetTextOfPropertyName(property.name);
14330
+ return key === propName || key2 && key2 === propName ? callback(property) : void 0;
14332
14331
  });
14333
14332
  }
14334
14333
  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);
14334
+ return forEachPropertyAssignment(
14335
+ objectLiteral,
14336
+ propKey,
14337
+ (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
14338
+ );
14336
14339
  }
14337
14340
  function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
14338
14341
  if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
@@ -14341,11 +14344,10 @@ ${lanes.join("\n")}
14341
14344
  }
14342
14345
  }
14343
14346
  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);
14347
+ return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
14345
14348
  }
14346
- function getTsConfigPropArray(tsConfigSourceFile, propKey) {
14347
- const jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile);
14348
- return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray;
14349
+ function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
14350
+ return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback);
14349
14351
  }
14350
14352
  function getContainingFunction(node) {
14351
14353
  return findAncestor(node.parent, isFunctionLike);
@@ -36253,7 +36255,7 @@ ${lanes.join("\n")}
36253
36255
  if (sourceFile) {
36254
36256
  const fileName = configFileName || "tsconfig.json";
36255
36257
  const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
36256
- const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
36258
+ const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer);
36257
36259
  const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
36258
36260
  errors.push(error);
36259
36261
  } else {
@@ -37949,6 +37951,7 @@ ${lanes.join("\n")}
37949
37951
  name: "allowImportingTsExtensions",
37950
37952
  type: "boolean",
37951
37953
  affectsSemanticDiagnostics: true,
37954
+ affectsBuildInfo: true,
37952
37955
  category: Diagnostics.Modules,
37953
37956
  description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
37954
37957
  defaultValueDescription: false
@@ -39672,7 +39675,7 @@ ${lanes.join("\n")}
39672
39675
  }
39673
39676
  function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
39674
39677
  return nodeModuleNameResolverWorker(
39675
- 8 /* Exports */,
39678
+ 30 /* NodeNextDefault */,
39676
39679
  moduleName,
39677
39680
  getDirectoryPath(containingFile),
39678
39681
  { moduleResolution: 99 /* NodeNext */ },
@@ -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;
@@ -128647,6 +128698,7 @@ ${lanes.join("\n")}
128647
128698
  147 /* ReadonlyKeyword */,
128648
128699
  153 /* StringKeyword */,
128649
128700
  154 /* SymbolKeyword */,
128701
+ 113 /* TypeOfKeyword */,
128650
128702
  111 /* TrueKeyword */,
128651
128703
  115 /* VoidKeyword */,
128652
128704
  156 /* UndefinedKeyword */,
@@ -146944,7 +146996,7 @@ ${lanes.join("\n")}
146944
146996
  /*checkArgumentIsStringLiteralLike*/
146945
146997
  true
146946
146998
  )) {
146947
- throw Debug.failBadSyntaxKind(parent2);
146999
+ Debug.failBadSyntaxKind(parent2);
146948
147000
  }
146949
147001
  const decl = cast(parent2.parent, isVariableDeclaration);
146950
147002
  const defaultImportName = tryCast(decl.name, isIdentifier);
@@ -148823,7 +148875,7 @@ ${lanes.join("\n")}
148823
148875
  }
148824
148876
  function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
148825
148877
  const replacementSpan = importStatementCompletion.replacementSpan;
148826
- const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
148878
+ const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
148827
148879
  const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
148828
148880
  const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
148829
148881
  const importKind = ts_codefix_exports.getImportKind(
@@ -150410,7 +150462,7 @@ ${lanes.join("\n")}
150410
150462
  return true;
150411
150463
  }
150412
150464
  }
150413
- return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !(isClassLike(contextToken2.parent) && (contextToken2 !== previousToken || position > previousToken.end));
150465
+ return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
150414
150466
  }
150415
150467
  function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
150416
150468
  return contextToken2.kind !== 63 /* EqualsToken */ && (contextToken2.kind === 26 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
@@ -160560,7 +160612,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160560
160612
  case 176 /* SetAccessor */:
160561
160613
  return `'set ${scope.name.getText()}'`;
160562
160614
  default:
160563
- throw Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
160615
+ Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`);
160564
160616
  }
160565
160617
  }
160566
160618
  function getDescriptionForClassLikeDeclaration(scope) {
@@ -168333,10 +168385,12 @@ ${options.prefix}` : "\n" : options.prefix
168333
168385
  forEachKey: () => forEachKey,
168334
168386
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
168335
168387
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
168388
+ forEachPropertyAssignment: () => forEachPropertyAssignment,
168336
168389
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
168337
168390
  forEachReturnStatement: () => forEachReturnStatement,
168338
168391
  forEachRight: () => forEachRight,
168339
168392
  forEachTrailingCommentRange: () => forEachTrailingCommentRange,
168393
+ forEachTsConfigPropArray: () => forEachTsConfigPropArray,
168340
168394
  forEachUnique: () => forEachUnique,
168341
168395
  forEachYieldExpression: () => forEachYieldExpression,
168342
168396
  forSomeAncestorDirectory: () => forSomeAncestorDirectory,
@@ -168669,7 +168723,6 @@ ${options.prefix}` : "\n" : options.prefix
168669
168723
  getProperties: () => getProperties,
168670
168724
  getProperty: () => getProperty,
168671
168725
  getPropertyArrayElementValue: () => getPropertyArrayElementValue,
168672
- getPropertyAssignment: () => getPropertyAssignment,
168673
168726
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
168674
168727
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
168675
168728
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
@@ -168774,7 +168827,6 @@ ${options.prefix}` : "\n" : options.prefix
168774
168827
  getTransformers: () => getTransformers,
168775
168828
  getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
168776
168829
  getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
168777
- getTsConfigPropArray: () => getTsConfigPropArray,
168778
168830
  getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
168779
168831
  getTypeAnnotationNode: () => getTypeAnnotationNode,
168780
168832
  getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-dev.20230321`;
57
+ var version = `${versionMajorMinor}.0-dev.20230323`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -6014,6 +6014,7 @@ var Diagnostics = {
6014
6014
  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?"),
6015
6015
  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."),
6016
6016
  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."),
6017
+ 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}."),
6017
6018
  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}'."),
6018
6019
  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}'."),
6019
6020
  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}'."),
@@ -26123,6 +26124,7 @@ var commandOptionsWithoutBuild = [
26123
26124
  name: "allowImportingTsExtensions",
26124
26125
  type: "boolean",
26125
26126
  affectsSemanticDiagnostics: true,
26127
+ affectsBuildInfo: true,
26126
26128
  category: Diagnostics.Modules,
26127
26129
  description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
26128
26130
  defaultValueDescription: false
@@ -31352,7 +31354,7 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
31352
31354
  case 0 /* Ok */:
31353
31355
  return Debug.fail();
31354
31356
  default:
31355
- throw Debug.assertNever(result);
31357
+ Debug.assertNever(result);
31356
31358
  }
31357
31359
  }
31358
31360
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.0-dev.20230321",
5
+ "version": "5.1.0-dev.20230323",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "14.21.1",
114
114
  "npm": "8.19.3"
115
115
  },
116
- "gitHead": "f218a562bfb417ecec263fc96d7a7a71abf96268"
116
+ "gitHead": "7009c76d00218195c905bb0231033e92cc87fbcd"
117
117
  }