@typescript-deploys/pr-build 5.4.0-pr-56911-7 → 5.4.0-pr-56392-10

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
@@ -44254,19 +44254,6 @@ function createTypeChecker(host) {
44254
44254
  emptyArray
44255
44255
  );
44256
44256
  var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
44257
- var keyofConstraintObjectType = createAnonymousType(
44258
- /*symbol*/
44259
- void 0,
44260
- emptySymbols,
44261
- emptyArray,
44262
- emptyArray,
44263
- [stringType, numberType, esSymbolType].map((t) => createIndexInfo(
44264
- t,
44265
- unknownType,
44266
- /*isReadonly*/
44267
- false
44268
- ))
44269
- );
44270
44257
  var emptyGenericType = createAnonymousType(
44271
44258
  /*symbol*/
44272
44259
  void 0,
@@ -45023,7 +45010,11 @@ function createTypeChecker(host) {
45023
45010
  if (errorBindingElement) {
45024
45011
  return findAncestor(errorBindingElement, isBindingElement) !== findAncestor(declaration, isBindingElement) || declaration.pos < errorBindingElement.pos;
45025
45012
  }
45026
- return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 260 /* VariableDeclaration */), usage);
45013
+ const rootDeclaration = getRootDeclaration(declaration);
45014
+ if (rootDeclaration.kind !== 260 /* VariableDeclaration */) {
45015
+ return true;
45016
+ }
45017
+ return isBlockScopedNameDeclaredBeforeUse(rootDeclaration, usage);
45027
45018
  } else if (declaration.kind === 260 /* VariableDeclaration */) {
45028
45019
  return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
45029
45020
  } else if (isClassLike(declaration)) {
@@ -54543,13 +54534,17 @@ function createTypeChecker(host) {
54543
54534
  function replaceIndexedAccess(instantiable, type, replacement) {
54544
54535
  return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
54545
54536
  }
54546
- function getReverseMappedTypeMembersLimitingConstraint(type) {
54537
+ function getLimitedConstraint(type) {
54547
54538
  const constraint = getConstraintTypeFromMappedType(type.mappedType);
54548
- if (constraint === type.constraintType) {
54539
+ if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
54540
+ return;
54541
+ }
54542
+ const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
54543
+ if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
54549
54544
  return;
54550
54545
  }
54551
- const mapper = appendTypeMapping(type.mappedType.mapper, type.constraintType.type, keyofConstraintObjectType);
54552
- return getBaseConstraintOrType(instantiateType(constraint, mapper));
54546
+ const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
54547
+ return limitedConstraint !== neverType ? limitedConstraint : void 0;
54553
54548
  }
54554
54549
  function resolveReverseMappedTypeMembers(type) {
54555
54550
  const indexInfo = getIndexInfoOfType(type.source, stringType);
@@ -54558,11 +54553,11 @@ function createTypeChecker(host) {
54558
54553
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
54559
54554
  const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
54560
54555
  const members = createSymbolTable();
54561
- const membersLimitingConstraint = getReverseMappedTypeMembersLimitingConstraint(type);
54556
+ const limitedConstraint = getLimitedConstraint(type);
54562
54557
  for (const prop of getPropertiesOfType(type.source)) {
54563
- if (membersLimitingConstraint) {
54558
+ if (limitedConstraint) {
54564
54559
  const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
54565
- if (!isTypeAssignableTo(propertyNameType, membersLimitingConstraint)) {
54560
+ if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
54566
54561
  continue;
54567
54562
  }
54568
54563
  }
@@ -64840,7 +64835,7 @@ function createTypeChecker(host) {
64840
64835
  }
64841
64836
  }
64842
64837
  function inferToMappedType(source, target, constraintType) {
64843
- if (constraintType.flags & 3145728 /* UnionOrIntersection */) {
64838
+ if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
64844
64839
  let result = false;
64845
64840
  for (const type of constraintType.types) {
64846
64841
  result = inferToMappedType(source, target, type) || result;
@@ -65344,29 +65339,9 @@ function createTypeChecker(host) {
65344
65339
  /*ignoreErrors*/
65345
65340
  true
65346
65341
  );
65347
- if (!symbol || !(isConstantVariable(symbol) || symbol.flags & 8 /* EnumMember */))
65348
- return void 0;
65349
- const declaration = symbol.valueDeclaration;
65350
- if (declaration === void 0)
65342
+ if (!symbol || symbol.valueDeclaration && !isBlockScopedNameDeclaredBeforeUse(symbol.valueDeclaration, node))
65351
65343
  return void 0;
65352
- const type = tryGetTypeFromEffectiveTypeNode(declaration);
65353
- if (type) {
65354
- const name = tryGetNameFromType(type);
65355
- if (name !== void 0) {
65356
- return name;
65357
- }
65358
- }
65359
- if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
65360
- const initializer = getEffectiveInitializer(declaration);
65361
- if (initializer) {
65362
- const initializerType = isBindingPattern(declaration.parent) ? getTypeForBindingElement(declaration) : getTypeOfExpression(initializer);
65363
- return initializerType && tryGetNameFromType(initializerType);
65364
- }
65365
- if (isEnumMember(declaration)) {
65366
- return getTextOfPropertyName(declaration.name);
65367
- }
65368
- }
65369
- return void 0;
65344
+ return tryGetNameFromType(getTypeOfExpression(node));
65370
65345
  }
65371
65346
  function containsMatchingReference(source, target) {
65372
65347
  while (isAccessExpression(source)) {
package/lib/tsserver.js CHANGED
@@ -48982,19 +48982,6 @@ function createTypeChecker(host) {
48982
48982
  emptyArray
48983
48983
  );
48984
48984
  var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
48985
- var keyofConstraintObjectType = createAnonymousType(
48986
- /*symbol*/
48987
- void 0,
48988
- emptySymbols,
48989
- emptyArray,
48990
- emptyArray,
48991
- [stringType, numberType, esSymbolType].map((t) => createIndexInfo(
48992
- t,
48993
- unknownType,
48994
- /*isReadonly*/
48995
- false
48996
- ))
48997
- );
48998
48985
  var emptyGenericType = createAnonymousType(
48999
48986
  /*symbol*/
49000
48987
  void 0,
@@ -49751,7 +49738,11 @@ function createTypeChecker(host) {
49751
49738
  if (errorBindingElement) {
49752
49739
  return findAncestor(errorBindingElement, isBindingElement) !== findAncestor(declaration, isBindingElement) || declaration.pos < errorBindingElement.pos;
49753
49740
  }
49754
- return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 260 /* VariableDeclaration */), usage);
49741
+ const rootDeclaration = getRootDeclaration(declaration);
49742
+ if (rootDeclaration.kind !== 260 /* VariableDeclaration */) {
49743
+ return true;
49744
+ }
49745
+ return isBlockScopedNameDeclaredBeforeUse(rootDeclaration, usage);
49755
49746
  } else if (declaration.kind === 260 /* VariableDeclaration */) {
49756
49747
  return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
49757
49748
  } else if (isClassLike(declaration)) {
@@ -59271,13 +59262,17 @@ function createTypeChecker(host) {
59271
59262
  function replaceIndexedAccess(instantiable, type, replacement) {
59272
59263
  return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
59273
59264
  }
59274
- function getReverseMappedTypeMembersLimitingConstraint(type) {
59265
+ function getLimitedConstraint(type) {
59275
59266
  const constraint = getConstraintTypeFromMappedType(type.mappedType);
59276
- if (constraint === type.constraintType) {
59267
+ if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
59268
+ return;
59269
+ }
59270
+ const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
59271
+ if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
59277
59272
  return;
59278
59273
  }
59279
- const mapper = appendTypeMapping(type.mappedType.mapper, type.constraintType.type, keyofConstraintObjectType);
59280
- return getBaseConstraintOrType(instantiateType(constraint, mapper));
59274
+ const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
59275
+ return limitedConstraint !== neverType ? limitedConstraint : void 0;
59281
59276
  }
59282
59277
  function resolveReverseMappedTypeMembers(type) {
59283
59278
  const indexInfo = getIndexInfoOfType(type.source, stringType);
@@ -59286,11 +59281,11 @@ function createTypeChecker(host) {
59286
59281
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
59287
59282
  const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
59288
59283
  const members = createSymbolTable();
59289
- const membersLimitingConstraint = getReverseMappedTypeMembersLimitingConstraint(type);
59284
+ const limitedConstraint = getLimitedConstraint(type);
59290
59285
  for (const prop of getPropertiesOfType(type.source)) {
59291
- if (membersLimitingConstraint) {
59286
+ if (limitedConstraint) {
59292
59287
  const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
59293
- if (!isTypeAssignableTo(propertyNameType, membersLimitingConstraint)) {
59288
+ if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
59294
59289
  continue;
59295
59290
  }
59296
59291
  }
@@ -69568,7 +69563,7 @@ function createTypeChecker(host) {
69568
69563
  }
69569
69564
  }
69570
69565
  function inferToMappedType(source, target, constraintType) {
69571
- if (constraintType.flags & 3145728 /* UnionOrIntersection */) {
69566
+ if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
69572
69567
  let result = false;
69573
69568
  for (const type of constraintType.types) {
69574
69569
  result = inferToMappedType(source, target, type) || result;
@@ -70072,29 +70067,9 @@ function createTypeChecker(host) {
70072
70067
  /*ignoreErrors*/
70073
70068
  true
70074
70069
  );
70075
- if (!symbol || !(isConstantVariable(symbol) || symbol.flags & 8 /* EnumMember */))
70076
- return void 0;
70077
- const declaration = symbol.valueDeclaration;
70078
- if (declaration === void 0)
70070
+ if (!symbol || symbol.valueDeclaration && !isBlockScopedNameDeclaredBeforeUse(symbol.valueDeclaration, node))
70079
70071
  return void 0;
70080
- const type = tryGetTypeFromEffectiveTypeNode(declaration);
70081
- if (type) {
70082
- const name = tryGetNameFromType(type);
70083
- if (name !== void 0) {
70084
- return name;
70085
- }
70086
- }
70087
- if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
70088
- const initializer = getEffectiveInitializer(declaration);
70089
- if (initializer) {
70090
- const initializerType = isBindingPattern(declaration.parent) ? getTypeForBindingElement(declaration) : getTypeOfExpression(initializer);
70091
- return initializerType && tryGetNameFromType(initializerType);
70092
- }
70093
- if (isEnumMember(declaration)) {
70094
- return getTextOfPropertyName(declaration.name);
70095
- }
70096
- }
70097
- return void 0;
70072
+ return tryGetNameFromType(getTypeOfExpression(node));
70098
70073
  }
70099
70074
  function containsMatchingReference(source, target) {
70100
70075
  while (isAccessExpression(source)) {
package/lib/typescript.js CHANGED
@@ -46736,19 +46736,6 @@ ${lanes.join("\n")}
46736
46736
  emptyArray
46737
46737
  );
46738
46738
  var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
46739
- var keyofConstraintObjectType = createAnonymousType(
46740
- /*symbol*/
46741
- void 0,
46742
- emptySymbols,
46743
- emptyArray,
46744
- emptyArray,
46745
- [stringType, numberType, esSymbolType].map((t) => createIndexInfo(
46746
- t,
46747
- unknownType,
46748
- /*isReadonly*/
46749
- false
46750
- ))
46751
- );
46752
46739
  var emptyGenericType = createAnonymousType(
46753
46740
  /*symbol*/
46754
46741
  void 0,
@@ -47505,7 +47492,11 @@ ${lanes.join("\n")}
47505
47492
  if (errorBindingElement) {
47506
47493
  return findAncestor(errorBindingElement, isBindingElement) !== findAncestor(declaration, isBindingElement) || declaration.pos < errorBindingElement.pos;
47507
47494
  }
47508
- return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 260 /* VariableDeclaration */), usage);
47495
+ const rootDeclaration = getRootDeclaration(declaration);
47496
+ if (rootDeclaration.kind !== 260 /* VariableDeclaration */) {
47497
+ return true;
47498
+ }
47499
+ return isBlockScopedNameDeclaredBeforeUse(rootDeclaration, usage);
47509
47500
  } else if (declaration.kind === 260 /* VariableDeclaration */) {
47510
47501
  return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
47511
47502
  } else if (isClassLike(declaration)) {
@@ -57025,13 +57016,17 @@ ${lanes.join("\n")}
57025
57016
  function replaceIndexedAccess(instantiable, type, replacement) {
57026
57017
  return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
57027
57018
  }
57028
- function getReverseMappedTypeMembersLimitingConstraint(type) {
57019
+ function getLimitedConstraint(type) {
57029
57020
  const constraint = getConstraintTypeFromMappedType(type.mappedType);
57030
- if (constraint === type.constraintType) {
57021
+ if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
57022
+ return;
57023
+ }
57024
+ const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
57025
+ if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
57031
57026
  return;
57032
57027
  }
57033
- const mapper = appendTypeMapping(type.mappedType.mapper, type.constraintType.type, keyofConstraintObjectType);
57034
- return getBaseConstraintOrType(instantiateType(constraint, mapper));
57028
+ const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
57029
+ return limitedConstraint !== neverType ? limitedConstraint : void 0;
57035
57030
  }
57036
57031
  function resolveReverseMappedTypeMembers(type) {
57037
57032
  const indexInfo = getIndexInfoOfType(type.source, stringType);
@@ -57040,11 +57035,11 @@ ${lanes.join("\n")}
57040
57035
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
57041
57036
  const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
57042
57037
  const members = createSymbolTable();
57043
- const membersLimitingConstraint = getReverseMappedTypeMembersLimitingConstraint(type);
57038
+ const limitedConstraint = getLimitedConstraint(type);
57044
57039
  for (const prop of getPropertiesOfType(type.source)) {
57045
- if (membersLimitingConstraint) {
57040
+ if (limitedConstraint) {
57046
57041
  const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
57047
- if (!isTypeAssignableTo(propertyNameType, membersLimitingConstraint)) {
57042
+ if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
57048
57043
  continue;
57049
57044
  }
57050
57045
  }
@@ -67322,7 +67317,7 @@ ${lanes.join("\n")}
67322
67317
  }
67323
67318
  }
67324
67319
  function inferToMappedType(source, target, constraintType) {
67325
- if (constraintType.flags & 3145728 /* UnionOrIntersection */) {
67320
+ if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
67326
67321
  let result = false;
67327
67322
  for (const type of constraintType.types) {
67328
67323
  result = inferToMappedType(source, target, type) || result;
@@ -67826,29 +67821,9 @@ ${lanes.join("\n")}
67826
67821
  /*ignoreErrors*/
67827
67822
  true
67828
67823
  );
67829
- if (!symbol || !(isConstantVariable(symbol) || symbol.flags & 8 /* EnumMember */))
67824
+ if (!symbol || symbol.valueDeclaration && !isBlockScopedNameDeclaredBeforeUse(symbol.valueDeclaration, node))
67830
67825
  return void 0;
67831
- const declaration = symbol.valueDeclaration;
67832
- if (declaration === void 0)
67833
- return void 0;
67834
- const type = tryGetTypeFromEffectiveTypeNode(declaration);
67835
- if (type) {
67836
- const name = tryGetNameFromType(type);
67837
- if (name !== void 0) {
67838
- return name;
67839
- }
67840
- }
67841
- if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
67842
- const initializer = getEffectiveInitializer(declaration);
67843
- if (initializer) {
67844
- const initializerType = isBindingPattern(declaration.parent) ? getTypeForBindingElement(declaration) : getTypeOfExpression(initializer);
67845
- return initializerType && tryGetNameFromType(initializerType);
67846
- }
67847
- if (isEnumMember(declaration)) {
67848
- return getTextOfPropertyName(declaration.name);
67849
- }
67850
- }
67851
- return void 0;
67826
+ return tryGetNameFromType(getTypeOfExpression(node));
67852
67827
  }
67853
67828
  function containsMatchingReference(source, target) {
67854
67829
  while (isAccessExpression(source)) {
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.4.0-pr-56911-7",
5
+ "version": "5.4.0-pr-56392-10",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "3baf3b4e1804f2f32ace0d49b294bcf08f3ee314"
117
+ "gitHead": "61dc1bc3d564f6e826f3e71906739e211c36705b"
118
118
  }