@typescript-deploys/pr-build 5.3.0-pr-56161-5 → 5.3.0-pr-55811-15

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.3";
21
- var version = `${versionMajorMinor}.0-insiders.20231020`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231023`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -54051,6 +54051,18 @@ function createTypeChecker(host) {
54051
54051
  function replaceIndexedAccess(instantiable, type, replacement) {
54052
54052
  return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
54053
54053
  }
54054
+ function getLimitedConstraint(type) {
54055
+ const constraint = getConstraintTypeFromMappedType(type.mappedType);
54056
+ if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
54057
+ return;
54058
+ }
54059
+ const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
54060
+ if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
54061
+ return;
54062
+ }
54063
+ const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
54064
+ return limitedConstraint !== neverType ? limitedConstraint : void 0;
54065
+ }
54054
54066
  function resolveReverseMappedTypeMembers(type) {
54055
54067
  const indexInfo = getIndexInfoOfType(type.source, stringType);
54056
54068
  const modifiers = getMappedTypeModifiers(type.mappedType);
@@ -54058,7 +54070,14 @@ function createTypeChecker(host) {
54058
54070
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
54059
54071
  const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
54060
54072
  const members = createSymbolTable();
54073
+ const limitedConstraint = getLimitedConstraint(type);
54061
54074
  for (const prop of getPropertiesOfType(type.source)) {
54075
+ if (limitedConstraint) {
54076
+ const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
54077
+ if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
54078
+ continue;
54079
+ }
54080
+ }
54062
54081
  const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
54063
54082
  const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
54064
54083
  inferredProp.declarations = prop.declarations;
@@ -62732,6 +62751,9 @@ function createTypeChecker(host) {
62732
62751
  }
62733
62752
  function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
62734
62753
  if (depth >= maxDepth) {
62754
+ if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
62755
+ type = getMappedTargetWithSymbol(type);
62756
+ }
62735
62757
  if (type.flags & 2097152 /* Intersection */) {
62736
62758
  return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
62737
62759
  }
@@ -62740,7 +62762,7 @@ function createTypeChecker(host) {
62740
62762
  let lastTypeId = 0;
62741
62763
  for (let i = 0; i < depth; i++) {
62742
62764
  const t = stack[i];
62743
- if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
62765
+ if (hasMatchingRecursionIdentity(t, identity2)) {
62744
62766
  if (t.id >= lastTypeId) {
62745
62767
  count++;
62746
62768
  if (count >= maxDepth) {
@@ -62753,18 +62775,29 @@ function createTypeChecker(host) {
62753
62775
  }
62754
62776
  return false;
62755
62777
  }
62778
+ function getMappedTargetWithSymbol(type) {
62779
+ let target;
62780
+ while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) {
62781
+ type = target;
62782
+ }
62783
+ return type;
62784
+ }
62785
+ function hasMatchingRecursionIdentity(type, identity2) {
62786
+ if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
62787
+ type = getMappedTargetWithSymbol(type);
62788
+ }
62789
+ if (type.flags & 2097152 /* Intersection */) {
62790
+ return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2));
62791
+ }
62792
+ return getRecursionIdentity(type) === identity2;
62793
+ }
62756
62794
  function getRecursionIdentity(type) {
62757
62795
  if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
62758
62796
  if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
62759
62797
  return type.node;
62760
62798
  }
62761
- if (type.symbol) {
62762
- if (getObjectFlags(type) & 32 /* Mapped */) {
62763
- type = getMappedTargetWithSymbol(type);
62764
- }
62765
- if (!(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
62766
- return type.symbol;
62767
- }
62799
+ if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
62800
+ return type.symbol;
62768
62801
  }
62769
62802
  if (isTupleType(type)) {
62770
62803
  return type.target;
@@ -62784,13 +62817,6 @@ function createTypeChecker(host) {
62784
62817
  }
62785
62818
  return type;
62786
62819
  }
62787
- function getMappedTargetWithSymbol(type) {
62788
- let target = type;
62789
- while ((getObjectFlags(target) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && isMappedTypeWithKeyofConstraintDeclaration(target)) {
62790
- target = getModifiersTypeFromMappedType(target);
62791
- }
62792
- return target.symbol ? target : type;
62793
- }
62794
62820
  function isPropertyIdenticalTo(sourceProp, targetProp) {
62795
62821
  return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
62796
62822
  }
@@ -64172,7 +64198,7 @@ function createTypeChecker(host) {
64172
64198
  }
64173
64199
  }
64174
64200
  function inferToMappedType(source, target, constraintType) {
64175
- if (constraintType.flags & 1048576 /* Union */) {
64201
+ if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
64176
64202
  let result = false;
64177
64203
  for (const type of constraintType.types) {
64178
64204
  result = inferToMappedType(source, target, type) || result;
@@ -79690,7 +79716,7 @@ function createTypeChecker(host) {
79690
79716
  error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
79691
79717
  } else {
79692
79718
  const text = getTextOfPropertyName(member.name);
79693
- if (isNumericLiteralName(text)) {
79719
+ if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
79694
79720
  error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
79695
79721
  }
79696
79722
  }
package/lib/tsserver.js CHANGED
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
2328
2328
 
2329
2329
  // src/compiler/corePublic.ts
2330
2330
  var versionMajorMinor = "5.3";
2331
- var version = `${versionMajorMinor}.0-insiders.20231020`;
2331
+ var version = `${versionMajorMinor}.0-insiders.20231023`;
2332
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -58763,6 +58763,18 @@ function createTypeChecker(host) {
58763
58763
  function replaceIndexedAccess(instantiable, type, replacement) {
58764
58764
  return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
58765
58765
  }
58766
+ function getLimitedConstraint(type) {
58767
+ const constraint = getConstraintTypeFromMappedType(type.mappedType);
58768
+ if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
58769
+ return;
58770
+ }
58771
+ const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
58772
+ if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
58773
+ return;
58774
+ }
58775
+ const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
58776
+ return limitedConstraint !== neverType ? limitedConstraint : void 0;
58777
+ }
58766
58778
  function resolveReverseMappedTypeMembers(type) {
58767
58779
  const indexInfo = getIndexInfoOfType(type.source, stringType);
58768
58780
  const modifiers = getMappedTypeModifiers(type.mappedType);
@@ -58770,7 +58782,14 @@ function createTypeChecker(host) {
58770
58782
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
58771
58783
  const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
58772
58784
  const members = createSymbolTable();
58785
+ const limitedConstraint = getLimitedConstraint(type);
58773
58786
  for (const prop of getPropertiesOfType(type.source)) {
58787
+ if (limitedConstraint) {
58788
+ const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
58789
+ if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
58790
+ continue;
58791
+ }
58792
+ }
58774
58793
  const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
58775
58794
  const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
58776
58795
  inferredProp.declarations = prop.declarations;
@@ -67444,6 +67463,9 @@ function createTypeChecker(host) {
67444
67463
  }
67445
67464
  function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
67446
67465
  if (depth >= maxDepth) {
67466
+ if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
67467
+ type = getMappedTargetWithSymbol(type);
67468
+ }
67447
67469
  if (type.flags & 2097152 /* Intersection */) {
67448
67470
  return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
67449
67471
  }
@@ -67452,7 +67474,7 @@ function createTypeChecker(host) {
67452
67474
  let lastTypeId = 0;
67453
67475
  for (let i = 0; i < depth; i++) {
67454
67476
  const t = stack[i];
67455
- if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
67477
+ if (hasMatchingRecursionIdentity(t, identity2)) {
67456
67478
  if (t.id >= lastTypeId) {
67457
67479
  count++;
67458
67480
  if (count >= maxDepth) {
@@ -67465,18 +67487,29 @@ function createTypeChecker(host) {
67465
67487
  }
67466
67488
  return false;
67467
67489
  }
67490
+ function getMappedTargetWithSymbol(type) {
67491
+ let target;
67492
+ while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) {
67493
+ type = target;
67494
+ }
67495
+ return type;
67496
+ }
67497
+ function hasMatchingRecursionIdentity(type, identity2) {
67498
+ if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
67499
+ type = getMappedTargetWithSymbol(type);
67500
+ }
67501
+ if (type.flags & 2097152 /* Intersection */) {
67502
+ return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2));
67503
+ }
67504
+ return getRecursionIdentity(type) === identity2;
67505
+ }
67468
67506
  function getRecursionIdentity(type) {
67469
67507
  if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
67470
67508
  if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
67471
67509
  return type.node;
67472
67510
  }
67473
- if (type.symbol) {
67474
- if (getObjectFlags(type) & 32 /* Mapped */) {
67475
- type = getMappedTargetWithSymbol(type);
67476
- }
67477
- if (!(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
67478
- return type.symbol;
67479
- }
67511
+ if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
67512
+ return type.symbol;
67480
67513
  }
67481
67514
  if (isTupleType(type)) {
67482
67515
  return type.target;
@@ -67496,13 +67529,6 @@ function createTypeChecker(host) {
67496
67529
  }
67497
67530
  return type;
67498
67531
  }
67499
- function getMappedTargetWithSymbol(type) {
67500
- let target = type;
67501
- while ((getObjectFlags(target) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && isMappedTypeWithKeyofConstraintDeclaration(target)) {
67502
- target = getModifiersTypeFromMappedType(target);
67503
- }
67504
- return target.symbol ? target : type;
67505
- }
67506
67532
  function isPropertyIdenticalTo(sourceProp, targetProp) {
67507
67533
  return compareProperties2(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
67508
67534
  }
@@ -68884,7 +68910,7 @@ function createTypeChecker(host) {
68884
68910
  }
68885
68911
  }
68886
68912
  function inferToMappedType(source, target, constraintType) {
68887
- if (constraintType.flags & 1048576 /* Union */) {
68913
+ if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
68888
68914
  let result = false;
68889
68915
  for (const type of constraintType.types) {
68890
68916
  result = inferToMappedType(source, target, type) || result;
@@ -84402,7 +84428,7 @@ function createTypeChecker(host) {
84402
84428
  error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
84403
84429
  } else {
84404
84430
  const text = getTextOfPropertyName(member.name);
84405
- if (isNumericLiteralName(text)) {
84431
+ if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
84406
84432
  error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
84407
84433
  }
84408
84434
  }
@@ -149961,7 +149987,8 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
149961
149987
  defaultImport,
149962
149988
  namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
149963
149989
  namespaceLikeImport,
149964
- compilerOptions
149990
+ compilerOptions,
149991
+ preferences
149965
149992
  );
149966
149993
  newDeclarations = combine(newDeclarations, declarations);
149967
149994
  });
@@ -150666,7 +150693,8 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
150666
150693
  defaultImport,
150667
150694
  namedImports,
150668
150695
  namespaceLikeImport,
150669
- program.getCompilerOptions()
150696
+ program.getCompilerOptions(),
150697
+ preferences
150670
150698
  ),
150671
150699
  /*blankLineBetween*/
150672
150700
  true,
@@ -150798,7 +150826,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
150798
150826
  const newSpecifiers = stableSort(
150799
150827
  namedImports.map(
150800
150828
  (namedImport) => factory.createImportSpecifier(
150801
- (!clause.isTypeOnly || promoteFromTypeOnly2) && needsTypeOnly(namedImport),
150829
+ (!clause.isTypeOnly || promoteFromTypeOnly2) && shouldUseTypeOnly(namedImport, preferences),
150802
150830
  /*propertyName*/
150803
150831
  void 0,
150804
150832
  factory.createIdentifier(namedImport.name)
@@ -150862,21 +150890,24 @@ function getImportTypePrefix(moduleSpecifier, quotePreference) {
150862
150890
  function needsTypeOnly({ addAsTypeOnly }) {
150863
150891
  return addAsTypeOnly === 2 /* Required */;
150864
150892
  }
150865
- function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
150893
+ function shouldUseTypeOnly(info, preferences) {
150894
+ return needsTypeOnly(info) || !!preferences.preferTypeOnlyAutoImports && info.addAsTypeOnly !== 4 /* NotAllowed */;
150895
+ }
150896
+ function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions, preferences) {
150866
150897
  const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
150867
150898
  let statements;
150868
150899
  if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
150869
- const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
150900
+ const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || (compilerOptions.verbatimModuleSyntax || preferences.preferTypeOnlyAutoImports) && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
150870
150901
  statements = combine(
150871
150902
  statements,
150872
150903
  makeImport(
150873
150904
  defaultImport && factory.createIdentifier(defaultImport.name),
150874
150905
  namedImports == null ? void 0 : namedImports.map(
150875
- ({ addAsTypeOnly, name }) => factory.createImportSpecifier(
150876
- !topLevelTypeOnly && addAsTypeOnly === 2 /* Required */,
150906
+ (namedImport) => factory.createImportSpecifier(
150907
+ !topLevelTypeOnly && shouldUseTypeOnly(namedImport, preferences),
150877
150908
  /*propertyName*/
150878
150909
  void 0,
150879
- factory.createIdentifier(name)
150910
+ factory.createIdentifier(namedImport.name)
150880
150911
  )
150881
150912
  ),
150882
150913
  moduleSpecifier,
@@ -150889,14 +150920,14 @@ function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImp
150889
150920
  const declaration = namespaceLikeImport.importKind === 3 /* CommonJS */ ? factory.createImportEqualsDeclaration(
150890
150921
  /*modifiers*/
150891
150922
  void 0,
150892
- needsTypeOnly(namespaceLikeImport),
150923
+ shouldUseTypeOnly(namespaceLikeImport, preferences),
150893
150924
  factory.createIdentifier(namespaceLikeImport.name),
150894
150925
  factory.createExternalModuleReference(quotedModuleSpecifier)
150895
150926
  ) : factory.createImportDeclaration(
150896
150927
  /*modifiers*/
150897
150928
  void 0,
150898
150929
  factory.createImportClause(
150899
- needsTypeOnly(namespaceLikeImport),
150930
+ shouldUseTypeOnly(namespaceLikeImport, preferences),
150900
150931
  /*name*/
150901
150932
  void 0,
150902
150933
  factory.createNamespaceImport(factory.createIdentifier(namespaceLikeImport.name))
@@ -8742,6 +8742,7 @@ declare namespace ts {
8742
8742
  readonly interactiveInlayHints?: boolean;
8743
8743
  readonly allowRenameOfImportPath?: boolean;
8744
8744
  readonly autoImportFileExcludePatterns?: string[];
8745
+ readonly preferTypeOnlyAutoImports?: boolean;
8745
8746
  readonly organizeImportsIgnoreCase?: "auto" | boolean;
8746
8747
  readonly organizeImportsCollation?: "ordinal" | "unicode";
8747
8748
  readonly organizeImportsLocale?: string;
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.3";
38
- version = `${versionMajorMinor}.0-insiders.20231020`;
38
+ version = `${versionMajorMinor}.0-insiders.20231023`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -56530,6 +56530,18 @@ ${lanes.join("\n")}
56530
56530
  function replaceIndexedAccess(instantiable, type, replacement) {
56531
56531
  return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
56532
56532
  }
56533
+ function getLimitedConstraint(type) {
56534
+ const constraint = getConstraintTypeFromMappedType(type.mappedType);
56535
+ if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
56536
+ return;
56537
+ }
56538
+ const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
56539
+ if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
56540
+ return;
56541
+ }
56542
+ const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
56543
+ return limitedConstraint !== neverType ? limitedConstraint : void 0;
56544
+ }
56533
56545
  function resolveReverseMappedTypeMembers(type) {
56534
56546
  const indexInfo = getIndexInfoOfType(type.source, stringType);
56535
56547
  const modifiers = getMappedTypeModifiers(type.mappedType);
@@ -56537,7 +56549,14 @@ ${lanes.join("\n")}
56537
56549
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
56538
56550
  const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
56539
56551
  const members = createSymbolTable();
56552
+ const limitedConstraint = getLimitedConstraint(type);
56540
56553
  for (const prop of getPropertiesOfType(type.source)) {
56554
+ if (limitedConstraint) {
56555
+ const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
56556
+ if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
56557
+ continue;
56558
+ }
56559
+ }
56541
56560
  const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
56542
56561
  const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
56543
56562
  inferredProp.declarations = prop.declarations;
@@ -65211,6 +65230,9 @@ ${lanes.join("\n")}
65211
65230
  }
65212
65231
  function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
65213
65232
  if (depth >= maxDepth) {
65233
+ if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
65234
+ type = getMappedTargetWithSymbol(type);
65235
+ }
65214
65236
  if (type.flags & 2097152 /* Intersection */) {
65215
65237
  return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
65216
65238
  }
@@ -65219,7 +65241,7 @@ ${lanes.join("\n")}
65219
65241
  let lastTypeId = 0;
65220
65242
  for (let i = 0; i < depth; i++) {
65221
65243
  const t = stack[i];
65222
- if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
65244
+ if (hasMatchingRecursionIdentity(t, identity2)) {
65223
65245
  if (t.id >= lastTypeId) {
65224
65246
  count++;
65225
65247
  if (count >= maxDepth) {
@@ -65232,18 +65254,29 @@ ${lanes.join("\n")}
65232
65254
  }
65233
65255
  return false;
65234
65256
  }
65257
+ function getMappedTargetWithSymbol(type) {
65258
+ let target;
65259
+ while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) {
65260
+ type = target;
65261
+ }
65262
+ return type;
65263
+ }
65264
+ function hasMatchingRecursionIdentity(type, identity2) {
65265
+ if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
65266
+ type = getMappedTargetWithSymbol(type);
65267
+ }
65268
+ if (type.flags & 2097152 /* Intersection */) {
65269
+ return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2));
65270
+ }
65271
+ return getRecursionIdentity(type) === identity2;
65272
+ }
65235
65273
  function getRecursionIdentity(type) {
65236
65274
  if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
65237
65275
  if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
65238
65276
  return type.node;
65239
65277
  }
65240
- if (type.symbol) {
65241
- if (getObjectFlags(type) & 32 /* Mapped */) {
65242
- type = getMappedTargetWithSymbol(type);
65243
- }
65244
- if (!(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
65245
- return type.symbol;
65246
- }
65278
+ if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
65279
+ return type.symbol;
65247
65280
  }
65248
65281
  if (isTupleType(type)) {
65249
65282
  return type.target;
@@ -65263,13 +65296,6 @@ ${lanes.join("\n")}
65263
65296
  }
65264
65297
  return type;
65265
65298
  }
65266
- function getMappedTargetWithSymbol(type) {
65267
- let target = type;
65268
- while ((getObjectFlags(target) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && isMappedTypeWithKeyofConstraintDeclaration(target)) {
65269
- target = getModifiersTypeFromMappedType(target);
65270
- }
65271
- return target.symbol ? target : type;
65272
- }
65273
65299
  function isPropertyIdenticalTo(sourceProp, targetProp) {
65274
65300
  return compareProperties2(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
65275
65301
  }
@@ -66651,7 +66677,7 @@ ${lanes.join("\n")}
66651
66677
  }
66652
66678
  }
66653
66679
  function inferToMappedType(source, target, constraintType) {
66654
- if (constraintType.flags & 1048576 /* Union */) {
66680
+ if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
66655
66681
  let result = false;
66656
66682
  for (const type of constraintType.types) {
66657
66683
  result = inferToMappedType(source, target, type) || result;
@@ -82169,7 +82195,7 @@ ${lanes.join("\n")}
82169
82195
  error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
82170
82196
  } else {
82171
82197
  const text = getTextOfPropertyName(member.name);
82172
- if (isNumericLiteralName(text)) {
82198
+ if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
82173
82199
  error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
82174
82200
  }
82175
82201
  }
@@ -148682,7 +148708,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148682
148708
  defaultImport,
148683
148709
  namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
148684
148710
  namespaceLikeImport,
148685
- compilerOptions
148711
+ compilerOptions,
148712
+ preferences
148686
148713
  );
148687
148714
  newDeclarations = combine(newDeclarations, declarations);
148688
148715
  });
@@ -149387,7 +149414,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149387
149414
  defaultImport,
149388
149415
  namedImports,
149389
149416
  namespaceLikeImport,
149390
- program.getCompilerOptions()
149417
+ program.getCompilerOptions(),
149418
+ preferences
149391
149419
  ),
149392
149420
  /*blankLineBetween*/
149393
149421
  true,
@@ -149519,7 +149547,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149519
149547
  const newSpecifiers = stableSort(
149520
149548
  namedImports.map(
149521
149549
  (namedImport) => factory.createImportSpecifier(
149522
- (!clause.isTypeOnly || promoteFromTypeOnly2) && needsTypeOnly(namedImport),
149550
+ (!clause.isTypeOnly || promoteFromTypeOnly2) && shouldUseTypeOnly(namedImport, preferences),
149523
149551
  /*propertyName*/
149524
149552
  void 0,
149525
149553
  factory.createIdentifier(namedImport.name)
@@ -149583,21 +149611,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149583
149611
  function needsTypeOnly({ addAsTypeOnly }) {
149584
149612
  return addAsTypeOnly === 2 /* Required */;
149585
149613
  }
149586
- function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
149614
+ function shouldUseTypeOnly(info, preferences) {
149615
+ return needsTypeOnly(info) || !!preferences.preferTypeOnlyAutoImports && info.addAsTypeOnly !== 4 /* NotAllowed */;
149616
+ }
149617
+ function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions, preferences) {
149587
149618
  const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
149588
149619
  let statements;
149589
149620
  if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
149590
- const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
149621
+ const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || (compilerOptions.verbatimModuleSyntax || preferences.preferTypeOnlyAutoImports) && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
149591
149622
  statements = combine(
149592
149623
  statements,
149593
149624
  makeImport(
149594
149625
  defaultImport && factory.createIdentifier(defaultImport.name),
149595
149626
  namedImports == null ? void 0 : namedImports.map(
149596
- ({ addAsTypeOnly, name }) => factory.createImportSpecifier(
149597
- !topLevelTypeOnly && addAsTypeOnly === 2 /* Required */,
149627
+ (namedImport) => factory.createImportSpecifier(
149628
+ !topLevelTypeOnly && shouldUseTypeOnly(namedImport, preferences),
149598
149629
  /*propertyName*/
149599
149630
  void 0,
149600
- factory.createIdentifier(name)
149631
+ factory.createIdentifier(namedImport.name)
149601
149632
  )
149602
149633
  ),
149603
149634
  moduleSpecifier,
@@ -149610,14 +149641,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149610
149641
  const declaration = namespaceLikeImport.importKind === 3 /* CommonJS */ ? factory.createImportEqualsDeclaration(
149611
149642
  /*modifiers*/
149612
149643
  void 0,
149613
- needsTypeOnly(namespaceLikeImport),
149644
+ shouldUseTypeOnly(namespaceLikeImport, preferences),
149614
149645
  factory.createIdentifier(namespaceLikeImport.name),
149615
149646
  factory.createExternalModuleReference(quotedModuleSpecifier)
149616
149647
  ) : factory.createImportDeclaration(
149617
149648
  /*modifiers*/
149618
149649
  void 0,
149619
149650
  factory.createImportClause(
149620
- needsTypeOnly(namespaceLikeImport),
149651
+ shouldUseTypeOnly(namespaceLikeImport, preferences),
149621
149652
  /*name*/
149622
149653
  void 0,
149623
149654
  factory.createNamespaceImport(factory.createIdentifier(namespaceLikeImport.name))
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.3";
57
- var version = `${versionMajorMinor}.0-insiders.20231020`;
57
+ var version = `${versionMajorMinor}.0-insiders.20231023`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.3.0-pr-56161-5",
5
+ "version": "5.3.0-pr-55811-15",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "20.1.0",
116
116
  "npm": "8.19.4"
117
117
  },
118
- "gitHead": "dcaa0b853cdd7d1d26b312a499a64451a9fe41e5"
118
+ "gitHead": "2aeee792ffeabc91b8b8d9806cc4c3be910d772b"
119
119
  }