@typescript-deploys/pr-build 5.4.0-pr-49218-45 → 5.4.0-pr-55774-44

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
@@ -54630,6 +54630,14 @@ function createTypeChecker(host) {
54630
54630
  return getCheckFlags(s) & 4096 /* Late */;
54631
54631
  }
54632
54632
  function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
54633
+ if (isTupleType(type)) {
54634
+ forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
54635
+ return;
54636
+ }
54637
+ if (isArrayType(type)) {
54638
+ cb(numberType);
54639
+ return;
54640
+ }
54633
54641
  for (const prop of getPropertiesOfType(type)) {
54634
54642
  cb(getLiteralTypeFromProperty(prop, include));
54635
54643
  }
@@ -56514,7 +56522,7 @@ function createTypeChecker(host) {
56514
56522
  if (constraint) {
56515
56523
  constraints = append(constraints, constraint);
56516
56524
  }
56517
- } else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && node === parent.type) {
56525
+ } else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && (node === parent.type || node === parent.nameType)) {
56518
56526
  const mappedType = getTypeFromTypeNode(parent);
56519
56527
  if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
56520
56528
  const typeParameter = getHomomorphicTypeVariable(mappedType);
@@ -60529,37 +60537,7 @@ function createTypeChecker(host) {
60529
60537
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
60530
60538
  for (let i = 0; i < paramCount; i++) {
60531
60539
  const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
60532
- let targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
60533
- if (i === restIndex && targetType && sourceType && isTupleType(sourceType)) {
60534
- targetType = mapType(targetType, (t) => {
60535
- if (!isTupleType(t) || // When both sides are tuples of the same structure, we don't want to "propagate" types from elements of variable positions
60536
- // to the following positions as that would disallow signatures of the exact same structures when trailing fixed elements are involved:
60537
- //
60538
- // let fn: (...rest: [...string[], number]) => void = (...rest: [...string[], number]) => {}; // ok
60539
- //
60540
- // Since we want to allow contextual types to flow into paremeters, we don't need to differentiate between rest and variadic elements
60541
- // as that doesn't affect the contextual type of the parameter
60542
- isTupleTypeStructureMatching(sourceType, t, 2 /* MatchVariable */)) {
60543
- return t;
60544
- }
60545
- const elementTypes = [];
60546
- const elementFlags = [];
60547
- const sourceArity = getTypeReferenceArity(sourceType);
60548
- const targetArity = getTypeReferenceArity(t);
60549
- for (let i2 = 0; i2 < sourceArity; i2++) {
60550
- if (i2 >= targetArity) {
60551
- if (sourceType.target.elementFlags[i2] & 3 /* Fixed */) {
60552
- elementTypes.push(undefinedType);
60553
- elementFlags.push(sourceType.target.elementFlags[i2]);
60554
- }
60555
- continue;
60556
- }
60557
- elementTypes.push(getTupleElementType(t, i2));
60558
- elementFlags.push(sourceType.target.elementFlags[i2]);
60559
- }
60560
- return createTupleType(elementTypes, elementFlags);
60561
- });
60562
- }
60540
+ const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
60563
60541
  if (sourceType && targetType) {
60564
60542
  const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
60565
60543
  const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -63816,11 +63794,8 @@ function createTypeChecker(host) {
63816
63794
  }
63817
63795
  return void 0;
63818
63796
  }
63819
- function isTupleTypeStructureMatching(t1, t2, tupleStructureComparisonKind) {
63820
- return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f1, i) => {
63821
- const f2 = t2.target.elementFlags[i];
63822
- return f1 === f2 || !!(tupleStructureComparisonKind & 1 /* MatchFixed */ && f1 & 3 /* Fixed */ && f2 & 3 /* Fixed */) || !!(tupleStructureComparisonKind & 2 /* MatchVariable */ && f1 & 12 /* Variable */ && f2 & 12 /* Variable */);
63823
- });
63797
+ function isTupleTypeStructureMatching(t1, t2) {
63798
+ return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f, i) => (f & 12 /* Variable */) === (t2.target.elementFlags[i] & 12 /* Variable */));
63824
63799
  }
63825
63800
  function isZeroBigInt({ value }) {
63826
63801
  return value.base10Value === "0";
@@ -65028,7 +65003,7 @@ function createTypeChecker(host) {
65028
65003
  const targetArity = getTypeReferenceArity(target);
65029
65004
  const elementTypes = getTypeArguments(target);
65030
65005
  const elementFlags = target.target.elementFlags;
65031
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target, 1 /* MatchFixed */)) {
65006
+ if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
65032
65007
  for (let i = 0; i < targetArity; i++) {
65033
65008
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
65034
65009
  }
@@ -119634,7 +119609,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119634
119609
  }
119635
119610
  const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
119636
119611
  const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension);
119637
- const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
119612
+ const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
119638
119613
  const resolvedFileName = resolution.resolvedFileName;
119639
119614
  if (isFromNodeModulesSearch) {
119640
119615
  currentNodeModulesDepth++;
package/lib/tsserver.js CHANGED
@@ -59368,6 +59368,14 @@ function createTypeChecker(host) {
59368
59368
  return getCheckFlags(s) & 4096 /* Late */;
59369
59369
  }
59370
59370
  function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
59371
+ if (isTupleType(type)) {
59372
+ forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
59373
+ return;
59374
+ }
59375
+ if (isArrayType(type)) {
59376
+ cb(numberType);
59377
+ return;
59378
+ }
59371
59379
  for (const prop of getPropertiesOfType(type)) {
59372
59380
  cb(getLiteralTypeFromProperty(prop, include));
59373
59381
  }
@@ -61252,7 +61260,7 @@ function createTypeChecker(host) {
61252
61260
  if (constraint) {
61253
61261
  constraints = append(constraints, constraint);
61254
61262
  }
61255
- } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
61263
+ } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && (node === parent2.type || node === parent2.nameType)) {
61256
61264
  const mappedType = getTypeFromTypeNode(parent2);
61257
61265
  if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
61258
61266
  const typeParameter = getHomomorphicTypeVariable(mappedType);
@@ -65267,37 +65275,7 @@ function createTypeChecker(host) {
65267
65275
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
65268
65276
  for (let i = 0; i < paramCount; i++) {
65269
65277
  const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
65270
- let targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
65271
- if (i === restIndex && targetType && sourceType && isTupleType(sourceType)) {
65272
- targetType = mapType(targetType, (t) => {
65273
- if (!isTupleType(t) || // When both sides are tuples of the same structure, we don't want to "propagate" types from elements of variable positions
65274
- // to the following positions as that would disallow signatures of the exact same structures when trailing fixed elements are involved:
65275
- //
65276
- // let fn: (...rest: [...string[], number]) => void = (...rest: [...string[], number]) => {}; // ok
65277
- //
65278
- // Since we want to allow contextual types to flow into paremeters, we don't need to differentiate between rest and variadic elements
65279
- // as that doesn't affect the contextual type of the parameter
65280
- isTupleTypeStructureMatching(sourceType, t, 2 /* MatchVariable */)) {
65281
- return t;
65282
- }
65283
- const elementTypes = [];
65284
- const elementFlags = [];
65285
- const sourceArity = getTypeReferenceArity(sourceType);
65286
- const targetArity = getTypeReferenceArity(t);
65287
- for (let i2 = 0; i2 < sourceArity; i2++) {
65288
- if (i2 >= targetArity) {
65289
- if (sourceType.target.elementFlags[i2] & 3 /* Fixed */) {
65290
- elementTypes.push(undefinedType);
65291
- elementFlags.push(sourceType.target.elementFlags[i2]);
65292
- }
65293
- continue;
65294
- }
65295
- elementTypes.push(getTupleElementType(t, i2));
65296
- elementFlags.push(sourceType.target.elementFlags[i2]);
65297
- }
65298
- return createTupleType(elementTypes, elementFlags);
65299
- });
65300
- }
65278
+ const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
65301
65279
  if (sourceType && targetType) {
65302
65280
  const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
65303
65281
  const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -68554,11 +68532,8 @@ function createTypeChecker(host) {
68554
68532
  }
68555
68533
  return void 0;
68556
68534
  }
68557
- function isTupleTypeStructureMatching(t1, t2, tupleStructureComparisonKind) {
68558
- return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f1, i) => {
68559
- const f2 = t2.target.elementFlags[i];
68560
- return f1 === f2 || !!(tupleStructureComparisonKind & 1 /* MatchFixed */ && f1 & 3 /* Fixed */ && f2 & 3 /* Fixed */) || !!(tupleStructureComparisonKind & 2 /* MatchVariable */ && f1 & 12 /* Variable */ && f2 & 12 /* Variable */);
68561
- });
68535
+ function isTupleTypeStructureMatching(t1, t2) {
68536
+ return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f, i) => (f & 12 /* Variable */) === (t2.target.elementFlags[i] & 12 /* Variable */));
68562
68537
  }
68563
68538
  function isZeroBigInt({ value }) {
68564
68539
  return value.base10Value === "0";
@@ -69766,7 +69741,7 @@ function createTypeChecker(host) {
69766
69741
  const targetArity = getTypeReferenceArity(target);
69767
69742
  const elementTypes = getTypeArguments(target);
69768
69743
  const elementFlags = target.target.elementFlags;
69769
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target, 1 /* MatchFixed */)) {
69744
+ if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
69770
69745
  for (let i = 0; i < targetArity; i++) {
69771
69746
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
69772
69747
  }
@@ -124597,7 +124572,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124597
124572
  }
124598
124573
  const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
124599
124574
  const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension);
124600
- const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
124575
+ const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
124601
124576
  const resolvedFileName = resolution.resolvedFileName;
124602
124577
  if (isFromNodeModulesSearch) {
124603
124578
  currentNodeModulesDepth++;
package/lib/typescript.js CHANGED
@@ -57123,6 +57123,14 @@ ${lanes.join("\n")}
57123
57123
  return getCheckFlags(s) & 4096 /* Late */;
57124
57124
  }
57125
57125
  function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
57126
+ if (isTupleType(type)) {
57127
+ forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
57128
+ return;
57129
+ }
57130
+ if (isArrayType(type)) {
57131
+ cb(numberType);
57132
+ return;
57133
+ }
57126
57134
  for (const prop of getPropertiesOfType(type)) {
57127
57135
  cb(getLiteralTypeFromProperty(prop, include));
57128
57136
  }
@@ -59007,7 +59015,7 @@ ${lanes.join("\n")}
59007
59015
  if (constraint) {
59008
59016
  constraints = append(constraints, constraint);
59009
59017
  }
59010
- } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
59018
+ } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && (node === parent2.type || node === parent2.nameType)) {
59011
59019
  const mappedType = getTypeFromTypeNode(parent2);
59012
59020
  if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
59013
59021
  const typeParameter = getHomomorphicTypeVariable(mappedType);
@@ -63022,37 +63030,7 @@ ${lanes.join("\n")}
63022
63030
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
63023
63031
  for (let i = 0; i < paramCount; i++) {
63024
63032
  const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
63025
- let targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
63026
- if (i === restIndex && targetType && sourceType && isTupleType(sourceType)) {
63027
- targetType = mapType(targetType, (t) => {
63028
- if (!isTupleType(t) || // When both sides are tuples of the same structure, we don't want to "propagate" types from elements of variable positions
63029
- // to the following positions as that would disallow signatures of the exact same structures when trailing fixed elements are involved:
63030
- //
63031
- // let fn: (...rest: [...string[], number]) => void = (...rest: [...string[], number]) => {}; // ok
63032
- //
63033
- // Since we want to allow contextual types to flow into paremeters, we don't need to differentiate between rest and variadic elements
63034
- // as that doesn't affect the contextual type of the parameter
63035
- isTupleTypeStructureMatching(sourceType, t, 2 /* MatchVariable */)) {
63036
- return t;
63037
- }
63038
- const elementTypes = [];
63039
- const elementFlags = [];
63040
- const sourceArity = getTypeReferenceArity(sourceType);
63041
- const targetArity = getTypeReferenceArity(t);
63042
- for (let i2 = 0; i2 < sourceArity; i2++) {
63043
- if (i2 >= targetArity) {
63044
- if (sourceType.target.elementFlags[i2] & 3 /* Fixed */) {
63045
- elementTypes.push(undefinedType);
63046
- elementFlags.push(sourceType.target.elementFlags[i2]);
63047
- }
63048
- continue;
63049
- }
63050
- elementTypes.push(getTupleElementType(t, i2));
63051
- elementFlags.push(sourceType.target.elementFlags[i2]);
63052
- }
63053
- return createTupleType(elementTypes, elementFlags);
63054
- });
63055
- }
63033
+ const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
63056
63034
  if (sourceType && targetType) {
63057
63035
  const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
63058
63036
  const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -66309,11 +66287,8 @@ ${lanes.join("\n")}
66309
66287
  }
66310
66288
  return void 0;
66311
66289
  }
66312
- function isTupleTypeStructureMatching(t1, t2, tupleStructureComparisonKind) {
66313
- return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f1, i) => {
66314
- const f2 = t2.target.elementFlags[i];
66315
- return f1 === f2 || !!(tupleStructureComparisonKind & 1 /* MatchFixed */ && f1 & 3 /* Fixed */ && f2 & 3 /* Fixed */) || !!(tupleStructureComparisonKind & 2 /* MatchVariable */ && f1 & 12 /* Variable */ && f2 & 12 /* Variable */);
66316
- });
66290
+ function isTupleTypeStructureMatching(t1, t2) {
66291
+ return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f, i) => (f & 12 /* Variable */) === (t2.target.elementFlags[i] & 12 /* Variable */));
66317
66292
  }
66318
66293
  function isZeroBigInt({ value }) {
66319
66294
  return value.base10Value === "0";
@@ -67521,7 +67496,7 @@ ${lanes.join("\n")}
67521
67496
  const targetArity = getTypeReferenceArity(target);
67522
67497
  const elementTypes = getTypeArguments(target);
67523
67498
  const elementFlags = target.target.elementFlags;
67524
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target, 1 /* MatchFixed */)) {
67499
+ if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
67525
67500
  for (let i = 0; i < targetArity; i++) {
67526
67501
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
67527
67502
  }
@@ -122570,7 +122545,7 @@ ${lanes.join("\n")}
122570
122545
  }
122571
122546
  const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
122572
122547
  const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension);
122573
- const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
122548
+ const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
122574
122549
  const resolvedFileName = resolution.resolvedFileName;
122575
122550
  if (isFromNodeModulesSearch) {
122576
122551
  currentNodeModulesDepth++;
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-49218-45",
5
+ "version": "5.4.0-pr-55774-44",
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": "624e31924d903e31deffbf8358ff7d517e1a6ec3"
117
+ "gitHead": "2f017b81f44276be0e5b6b37fe6c609f52eae6c4"
118
118
  }