@typescript-deploys/pr-build 5.2.0-pr-54935-7 → 5.2.0-pr-49218-24

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.2";
21
- var version = `${versionMajorMinor}.0-insiders.20230709`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230710`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -48184,7 +48184,7 @@ function createTypeChecker(host) {
48184
48184
  return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
48185
48185
  }
48186
48186
  function addPropertyToElementList(propertySymbol, context, typeElements) {
48187
- var _a, _b;
48187
+ var _a;
48188
48188
  const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
48189
48189
  const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
48190
48190
  const saveEnclosingDeclaration = context.enclosingDeclaration;
@@ -48234,54 +48234,17 @@ function createTypeChecker(host) {
48234
48234
  context.reverseMappedStack.pop();
48235
48235
  }
48236
48236
  }
48237
- if (propertySymbol.flags & 98304 /* Accessor */) {
48238
- const modifierFlags = getDeclarationModifierFlagsFromSymbol(propertySymbol);
48239
- const flags = modifierFlags & ~(512 /* Async */ | 32 /* Static */ | 128 /* Accessor */);
48240
- if (propertySymbol.flags & 32768 /* GetAccessor */) {
48241
- const getAccessorSignature = factory.createGetAccessorDeclaration(
48242
- factory.createModifiersFromModifierFlags(flags),
48243
- propertyName,
48244
- [],
48245
- propertyTypeNode,
48246
- /*body*/
48247
- void 0
48248
- );
48249
- typeElements.push(preserveCommentsOn(getAccessorSignature));
48250
- }
48251
- if (propertySymbol.flags & 65536 /* SetAccessor */) {
48252
- const setAccessorDecl = find(propertySymbol.declarations, (decl) => decl.kind === 178 /* SetAccessor */);
48253
- const parameterName = ((_b = setAccessorDecl == null ? void 0 : setAccessorDecl.parameters) == null ? void 0 : _b.length) > 0 ? setAccessorDecl.parameters[0].name : "arg";
48254
- const setAccessorSignature = factory.createSetAccessorDeclaration(
48255
- factory.createModifiersFromModifierFlags(flags),
48256
- propertyName,
48257
- [factory.createParameterDeclaration(
48258
- /*modifiers*/
48259
- void 0,
48260
- /*dotDotDotToken*/
48261
- void 0,
48262
- parameterName,
48263
- /*questionToken*/
48264
- void 0,
48265
- propertyTypeNode
48266
- )],
48267
- /*body*/
48268
- void 0
48269
- );
48270
- typeElements.push(preserveCommentsOn(setAccessorSignature));
48271
- }
48272
- } else {
48273
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
48274
- if (modifiers) {
48275
- context.approximateLength += 9;
48276
- }
48277
- const propertySignature = factory.createPropertySignature(
48278
- modifiers,
48279
- propertyName,
48280
- optionalToken,
48281
- propertyTypeNode
48282
- );
48283
- typeElements.push(preserveCommentsOn(propertySignature));
48237
+ const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
48238
+ if (modifiers) {
48239
+ context.approximateLength += 9;
48284
48240
  }
48241
+ const propertySignature = factory.createPropertySignature(
48242
+ modifiers,
48243
+ propertyName,
48244
+ optionalToken,
48245
+ propertyTypeNode
48246
+ );
48247
+ typeElements.push(preserveCommentsOn(propertySignature));
48285
48248
  function preserveCommentsOn(node) {
48286
48249
  var _a2;
48287
48250
  if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
@@ -59504,7 +59467,37 @@ function createTypeChecker(host) {
59504
59467
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
59505
59468
  for (let i = 0; i < paramCount; i++) {
59506
59469
  const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
59507
- const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
59470
+ let targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
59471
+ if (i === restIndex && targetType && sourceType && isTupleType(sourceType)) {
59472
+ targetType = mapType(targetType, (t) => {
59473
+ if (!isTupleType(t) || // When both sides are tuples of the same structure, we don't want to "propagate" types from elements of variable positions
59474
+ // to the following positions as that would disallow signatures of the exact same structures when trailing fixed elements are involved:
59475
+ //
59476
+ // let fn: (...rest: [...string[], number]) => void = (...rest: [...string[], number]) => {}; // ok
59477
+ //
59478
+ // Since we want to allow contextual types to flow into paremeters, we don't need to differentiate between rest and variadic elements
59479
+ // as that doesn't affect the contextual type of the parameter
59480
+ isTupleTypeStructureMatching(sourceType, t, 2 /* MatchVariable */)) {
59481
+ return t;
59482
+ }
59483
+ const elementTypes = [];
59484
+ const elementFlags = [];
59485
+ const sourceArity = getTypeReferenceArity(sourceType);
59486
+ const targetArity = getTypeReferenceArity(t);
59487
+ for (let i2 = 0; i2 < sourceArity; i2++) {
59488
+ if (i2 >= targetArity) {
59489
+ if (sourceType.target.elementFlags[i2] & 3 /* Fixed */) {
59490
+ elementTypes.push(undefinedType);
59491
+ elementFlags.push(sourceType.target.elementFlags[i2]);
59492
+ }
59493
+ continue;
59494
+ }
59495
+ elementTypes.push(getTupleElementType(t, i2));
59496
+ elementFlags.push(sourceType.target.elementFlags[i2]);
59497
+ }
59498
+ return createTupleType(elementTypes, elementFlags);
59499
+ });
59500
+ }
59508
59501
  if (sourceType && targetType) {
59509
59502
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
59510
59503
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -62687,8 +62680,11 @@ function createTypeChecker(host) {
62687
62680
  }
62688
62681
  return void 0;
62689
62682
  }
62690
- function isTupleTypeStructureMatching(t1, t2) {
62691
- return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f, i) => (f & 12 /* Variable */) === (t2.target.elementFlags[i] & 12 /* Variable */));
62683
+ function isTupleTypeStructureMatching(t1, t2, tupleStructureComparisonKind) {
62684
+ return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f1, i) => {
62685
+ const f2 = t2.target.elementFlags[i];
62686
+ return f1 === f2 || !!(tupleStructureComparisonKind & 1 /* MatchFixed */ && f1 & 3 /* Fixed */ && f2 & 3 /* Fixed */) || !!(tupleStructureComparisonKind & 2 /* MatchVariable */ && f1 & 12 /* Variable */ && f2 & 12 /* Variable */);
62687
+ });
62692
62688
  }
62693
62689
  function isZeroBigInt({ value }) {
62694
62690
  return value.base10Value === "0";
@@ -63884,7 +63880,7 @@ function createTypeChecker(host) {
63884
63880
  const targetArity = getTypeReferenceArity(target);
63885
63881
  const elementTypes = getTypeArguments(target);
63886
63882
  const elementFlags = target.target.elementFlags;
63887
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
63883
+ if (isTupleType(source) && isTupleTypeStructureMatching(source, target, 1 /* MatchFixed */)) {
63888
63884
  for (let i = 0; i < targetArity; i++) {
63889
63885
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
63890
63886
  }
package/lib/tsserver.js CHANGED
@@ -2327,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
2327
2327
 
2328
2328
  // src/compiler/corePublic.ts
2329
2329
  var versionMajorMinor = "5.2";
2330
- var version = `${versionMajorMinor}.0-insiders.20230709`;
2330
+ var version = `${versionMajorMinor}.0-insiders.20230710`;
2331
2331
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2332
2332
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2333
2333
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -52891,7 +52891,7 @@ function createTypeChecker(host) {
52891
52891
  return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
52892
52892
  }
52893
52893
  function addPropertyToElementList(propertySymbol, context, typeElements) {
52894
- var _a, _b;
52894
+ var _a;
52895
52895
  const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
52896
52896
  const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
52897
52897
  const saveEnclosingDeclaration = context.enclosingDeclaration;
@@ -52941,54 +52941,17 @@ function createTypeChecker(host) {
52941
52941
  context.reverseMappedStack.pop();
52942
52942
  }
52943
52943
  }
52944
- if (propertySymbol.flags & 98304 /* Accessor */) {
52945
- const modifierFlags = getDeclarationModifierFlagsFromSymbol(propertySymbol);
52946
- const flags = modifierFlags & ~(512 /* Async */ | 32 /* Static */ | 128 /* Accessor */);
52947
- if (propertySymbol.flags & 32768 /* GetAccessor */) {
52948
- const getAccessorSignature = factory.createGetAccessorDeclaration(
52949
- factory.createModifiersFromModifierFlags(flags),
52950
- propertyName,
52951
- [],
52952
- propertyTypeNode,
52953
- /*body*/
52954
- void 0
52955
- );
52956
- typeElements.push(preserveCommentsOn(getAccessorSignature));
52957
- }
52958
- if (propertySymbol.flags & 65536 /* SetAccessor */) {
52959
- const setAccessorDecl = find(propertySymbol.declarations, (decl) => decl.kind === 178 /* SetAccessor */);
52960
- const parameterName = ((_b = setAccessorDecl == null ? void 0 : setAccessorDecl.parameters) == null ? void 0 : _b.length) > 0 ? setAccessorDecl.parameters[0].name : "arg";
52961
- const setAccessorSignature = factory.createSetAccessorDeclaration(
52962
- factory.createModifiersFromModifierFlags(flags),
52963
- propertyName,
52964
- [factory.createParameterDeclaration(
52965
- /*modifiers*/
52966
- void 0,
52967
- /*dotDotDotToken*/
52968
- void 0,
52969
- parameterName,
52970
- /*questionToken*/
52971
- void 0,
52972
- propertyTypeNode
52973
- )],
52974
- /*body*/
52975
- void 0
52976
- );
52977
- typeElements.push(preserveCommentsOn(setAccessorSignature));
52978
- }
52979
- } else {
52980
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
52981
- if (modifiers) {
52982
- context.approximateLength += 9;
52983
- }
52984
- const propertySignature = factory.createPropertySignature(
52985
- modifiers,
52986
- propertyName,
52987
- optionalToken,
52988
- propertyTypeNode
52989
- );
52990
- typeElements.push(preserveCommentsOn(propertySignature));
52944
+ const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
52945
+ if (modifiers) {
52946
+ context.approximateLength += 9;
52991
52947
  }
52948
+ const propertySignature = factory.createPropertySignature(
52949
+ modifiers,
52950
+ propertyName,
52951
+ optionalToken,
52952
+ propertyTypeNode
52953
+ );
52954
+ typeElements.push(preserveCommentsOn(propertySignature));
52992
52955
  function preserveCommentsOn(node) {
52993
52956
  var _a2;
52994
52957
  if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
@@ -64211,7 +64174,37 @@ function createTypeChecker(host) {
64211
64174
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
64212
64175
  for (let i = 0; i < paramCount; i++) {
64213
64176
  const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
64214
- const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
64177
+ let targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
64178
+ if (i === restIndex && targetType && sourceType && isTupleType(sourceType)) {
64179
+ targetType = mapType(targetType, (t) => {
64180
+ if (!isTupleType(t) || // When both sides are tuples of the same structure, we don't want to "propagate" types from elements of variable positions
64181
+ // to the following positions as that would disallow signatures of the exact same structures when trailing fixed elements are involved:
64182
+ //
64183
+ // let fn: (...rest: [...string[], number]) => void = (...rest: [...string[], number]) => {}; // ok
64184
+ //
64185
+ // Since we want to allow contextual types to flow into paremeters, we don't need to differentiate between rest and variadic elements
64186
+ // as that doesn't affect the contextual type of the parameter
64187
+ isTupleTypeStructureMatching(sourceType, t, 2 /* MatchVariable */)) {
64188
+ return t;
64189
+ }
64190
+ const elementTypes = [];
64191
+ const elementFlags = [];
64192
+ const sourceArity = getTypeReferenceArity(sourceType);
64193
+ const targetArity = getTypeReferenceArity(t);
64194
+ for (let i2 = 0; i2 < sourceArity; i2++) {
64195
+ if (i2 >= targetArity) {
64196
+ if (sourceType.target.elementFlags[i2] & 3 /* Fixed */) {
64197
+ elementTypes.push(undefinedType);
64198
+ elementFlags.push(sourceType.target.elementFlags[i2]);
64199
+ }
64200
+ continue;
64201
+ }
64202
+ elementTypes.push(getTupleElementType(t, i2));
64203
+ elementFlags.push(sourceType.target.elementFlags[i2]);
64204
+ }
64205
+ return createTupleType(elementTypes, elementFlags);
64206
+ });
64207
+ }
64215
64208
  if (sourceType && targetType) {
64216
64209
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
64217
64210
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -67394,8 +67387,11 @@ function createTypeChecker(host) {
67394
67387
  }
67395
67388
  return void 0;
67396
67389
  }
67397
- function isTupleTypeStructureMatching(t1, t2) {
67398
- return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f, i) => (f & 12 /* Variable */) === (t2.target.elementFlags[i] & 12 /* Variable */));
67390
+ function isTupleTypeStructureMatching(t1, t2, tupleStructureComparisonKind) {
67391
+ return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f1, i) => {
67392
+ const f2 = t2.target.elementFlags[i];
67393
+ return f1 === f2 || !!(tupleStructureComparisonKind & 1 /* MatchFixed */ && f1 & 3 /* Fixed */ && f2 & 3 /* Fixed */) || !!(tupleStructureComparisonKind & 2 /* MatchVariable */ && f1 & 12 /* Variable */ && f2 & 12 /* Variable */);
67394
+ });
67399
67395
  }
67400
67396
  function isZeroBigInt({ value }) {
67401
67397
  return value.base10Value === "0";
@@ -68591,7 +68587,7 @@ function createTypeChecker(host) {
68591
68587
  const targetArity = getTypeReferenceArity(target);
68592
68588
  const elementTypes = getTypeArguments(target);
68593
68589
  const elementFlags = target.target.elementFlags;
68594
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
68590
+ if (isTupleType(source) && isTupleTypeStructureMatching(source, target, 1 /* MatchFixed */)) {
68595
68591
  for (let i = 0; i < targetArity; i++) {
68596
68592
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
68597
68593
  }
@@ -132904,13 +132900,16 @@ function needsNameFromDeclaration(symbol) {
132904
132900
  return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
132905
132901
  }
132906
132902
  function getDefaultLikeExportNameFromDeclaration(symbol) {
132907
- return firstDefined(
132908
- symbol.declarations,
132909
- (d) => {
132910
- var _a, _b;
132911
- return isExportAssignment(d) ? (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text;
132903
+ return firstDefined(symbol.declarations, (d) => {
132904
+ var _a, _b, _c;
132905
+ if (isExportAssignment(d)) {
132906
+ return (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text;
132912
132907
  }
132913
- );
132908
+ if (isExportSpecifier(d) && d.symbol.flags === 2097152 /* Alias */) {
132909
+ return (_b = tryCast(d.propertyName, isIdentifier)) == null ? void 0 : _b.text;
132910
+ }
132911
+ return (_c = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _c.text;
132912
+ });
132914
132913
  }
132915
132914
  function getSymbolParentOrFail(symbol) {
132916
132915
  var _a;
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.2";
38
- version = `${versionMajorMinor}.0-insiders.20230709`;
38
+ version = `${versionMajorMinor}.0-insiders.20230710`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -50658,7 +50658,7 @@ ${lanes.join("\n")}
50658
50658
  return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
50659
50659
  }
50660
50660
  function addPropertyToElementList(propertySymbol, context, typeElements) {
50661
- var _a, _b;
50661
+ var _a;
50662
50662
  const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
50663
50663
  const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
50664
50664
  const saveEnclosingDeclaration = context.enclosingDeclaration;
@@ -50708,54 +50708,17 @@ ${lanes.join("\n")}
50708
50708
  context.reverseMappedStack.pop();
50709
50709
  }
50710
50710
  }
50711
- if (propertySymbol.flags & 98304 /* Accessor */) {
50712
- const modifierFlags = getDeclarationModifierFlagsFromSymbol(propertySymbol);
50713
- const flags = modifierFlags & ~(512 /* Async */ | 32 /* Static */ | 128 /* Accessor */);
50714
- if (propertySymbol.flags & 32768 /* GetAccessor */) {
50715
- const getAccessorSignature = factory.createGetAccessorDeclaration(
50716
- factory.createModifiersFromModifierFlags(flags),
50717
- propertyName,
50718
- [],
50719
- propertyTypeNode,
50720
- /*body*/
50721
- void 0
50722
- );
50723
- typeElements.push(preserveCommentsOn(getAccessorSignature));
50724
- }
50725
- if (propertySymbol.flags & 65536 /* SetAccessor */) {
50726
- const setAccessorDecl = find(propertySymbol.declarations, (decl) => decl.kind === 178 /* SetAccessor */);
50727
- const parameterName = ((_b = setAccessorDecl == null ? void 0 : setAccessorDecl.parameters) == null ? void 0 : _b.length) > 0 ? setAccessorDecl.parameters[0].name : "arg";
50728
- const setAccessorSignature = factory.createSetAccessorDeclaration(
50729
- factory.createModifiersFromModifierFlags(flags),
50730
- propertyName,
50731
- [factory.createParameterDeclaration(
50732
- /*modifiers*/
50733
- void 0,
50734
- /*dotDotDotToken*/
50735
- void 0,
50736
- parameterName,
50737
- /*questionToken*/
50738
- void 0,
50739
- propertyTypeNode
50740
- )],
50741
- /*body*/
50742
- void 0
50743
- );
50744
- typeElements.push(preserveCommentsOn(setAccessorSignature));
50745
- }
50746
- } else {
50747
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
50748
- if (modifiers) {
50749
- context.approximateLength += 9;
50750
- }
50751
- const propertySignature = factory.createPropertySignature(
50752
- modifiers,
50753
- propertyName,
50754
- optionalToken,
50755
- propertyTypeNode
50756
- );
50757
- typeElements.push(preserveCommentsOn(propertySignature));
50711
+ const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
50712
+ if (modifiers) {
50713
+ context.approximateLength += 9;
50758
50714
  }
50715
+ const propertySignature = factory.createPropertySignature(
50716
+ modifiers,
50717
+ propertyName,
50718
+ optionalToken,
50719
+ propertyTypeNode
50720
+ );
50721
+ typeElements.push(preserveCommentsOn(propertySignature));
50759
50722
  function preserveCommentsOn(node) {
50760
50723
  var _a2;
50761
50724
  if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
@@ -61978,7 +61941,37 @@ ${lanes.join("\n")}
61978
61941
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
61979
61942
  for (let i = 0; i < paramCount; i++) {
61980
61943
  const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
61981
- const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61944
+ let targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61945
+ if (i === restIndex && targetType && sourceType && isTupleType(sourceType)) {
61946
+ targetType = mapType(targetType, (t) => {
61947
+ if (!isTupleType(t) || // When both sides are tuples of the same structure, we don't want to "propagate" types from elements of variable positions
61948
+ // to the following positions as that would disallow signatures of the exact same structures when trailing fixed elements are involved:
61949
+ //
61950
+ // let fn: (...rest: [...string[], number]) => void = (...rest: [...string[], number]) => {}; // ok
61951
+ //
61952
+ // Since we want to allow contextual types to flow into paremeters, we don't need to differentiate between rest and variadic elements
61953
+ // as that doesn't affect the contextual type of the parameter
61954
+ isTupleTypeStructureMatching(sourceType, t, 2 /* MatchVariable */)) {
61955
+ return t;
61956
+ }
61957
+ const elementTypes = [];
61958
+ const elementFlags = [];
61959
+ const sourceArity = getTypeReferenceArity(sourceType);
61960
+ const targetArity = getTypeReferenceArity(t);
61961
+ for (let i2 = 0; i2 < sourceArity; i2++) {
61962
+ if (i2 >= targetArity) {
61963
+ if (sourceType.target.elementFlags[i2] & 3 /* Fixed */) {
61964
+ elementTypes.push(undefinedType);
61965
+ elementFlags.push(sourceType.target.elementFlags[i2]);
61966
+ }
61967
+ continue;
61968
+ }
61969
+ elementTypes.push(getTupleElementType(t, i2));
61970
+ elementFlags.push(sourceType.target.elementFlags[i2]);
61971
+ }
61972
+ return createTupleType(elementTypes, elementFlags);
61973
+ });
61974
+ }
61982
61975
  if (sourceType && targetType) {
61983
61976
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
61984
61977
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -65161,8 +65154,11 @@ ${lanes.join("\n")}
65161
65154
  }
65162
65155
  return void 0;
65163
65156
  }
65164
- function isTupleTypeStructureMatching(t1, t2) {
65165
- return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f, i) => (f & 12 /* Variable */) === (t2.target.elementFlags[i] & 12 /* Variable */));
65157
+ function isTupleTypeStructureMatching(t1, t2, tupleStructureComparisonKind) {
65158
+ return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f1, i) => {
65159
+ const f2 = t2.target.elementFlags[i];
65160
+ return f1 === f2 || !!(tupleStructureComparisonKind & 1 /* MatchFixed */ && f1 & 3 /* Fixed */ && f2 & 3 /* Fixed */) || !!(tupleStructureComparisonKind & 2 /* MatchVariable */ && f1 & 12 /* Variable */ && f2 & 12 /* Variable */);
65161
+ });
65166
65162
  }
65167
65163
  function isZeroBigInt({ value }) {
65168
65164
  return value.base10Value === "0";
@@ -66358,7 +66354,7 @@ ${lanes.join("\n")}
66358
66354
  const targetArity = getTypeReferenceArity(target);
66359
66355
  const elementTypes = getTypeArguments(target);
66360
66356
  const elementFlags = target.target.elementFlags;
66361
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
66357
+ if (isTupleType(source) && isTupleTypeStructureMatching(source, target, 1 /* MatchFixed */)) {
66362
66358
  for (let i = 0; i < targetArity; i++) {
66363
66359
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
66364
66360
  }
@@ -131162,13 +131158,16 @@ ${lanes.join("\n")}
131162
131158
  return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
131163
131159
  }
131164
131160
  function getDefaultLikeExportNameFromDeclaration(symbol) {
131165
- return firstDefined(
131166
- symbol.declarations,
131167
- (d) => {
131168
- var _a, _b;
131169
- return isExportAssignment(d) ? (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text;
131161
+ return firstDefined(symbol.declarations, (d) => {
131162
+ var _a, _b, _c;
131163
+ if (isExportAssignment(d)) {
131164
+ return (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text;
131170
131165
  }
131171
- );
131166
+ if (isExportSpecifier(d) && d.symbol.flags === 2097152 /* Alias */) {
131167
+ return (_b = tryCast(d.propertyName, isIdentifier)) == null ? void 0 : _b.text;
131168
+ }
131169
+ return (_c = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _c.text;
131170
+ });
131172
131171
  }
131173
131172
  function getSymbolParentOrFail(symbol) {
131174
131173
  var _a;
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.2";
38
- version = `${versionMajorMinor}.0-insiders.20230709`;
38
+ version = `${versionMajorMinor}.0-insiders.20230710`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -50658,7 +50658,7 @@ ${lanes.join("\n")}
50658
50658
  return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
50659
50659
  }
50660
50660
  function addPropertyToElementList(propertySymbol, context, typeElements) {
50661
- var _a, _b;
50661
+ var _a;
50662
50662
  const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
50663
50663
  const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
50664
50664
  const saveEnclosingDeclaration = context.enclosingDeclaration;
@@ -50708,54 +50708,17 @@ ${lanes.join("\n")}
50708
50708
  context.reverseMappedStack.pop();
50709
50709
  }
50710
50710
  }
50711
- if (propertySymbol.flags & 98304 /* Accessor */) {
50712
- const modifierFlags = getDeclarationModifierFlagsFromSymbol(propertySymbol);
50713
- const flags = modifierFlags & ~(512 /* Async */ | 32 /* Static */ | 128 /* Accessor */);
50714
- if (propertySymbol.flags & 32768 /* GetAccessor */) {
50715
- const getAccessorSignature = factory.createGetAccessorDeclaration(
50716
- factory.createModifiersFromModifierFlags(flags),
50717
- propertyName,
50718
- [],
50719
- propertyTypeNode,
50720
- /*body*/
50721
- void 0
50722
- );
50723
- typeElements.push(preserveCommentsOn(getAccessorSignature));
50724
- }
50725
- if (propertySymbol.flags & 65536 /* SetAccessor */) {
50726
- const setAccessorDecl = find(propertySymbol.declarations, (decl) => decl.kind === 178 /* SetAccessor */);
50727
- const parameterName = ((_b = setAccessorDecl == null ? void 0 : setAccessorDecl.parameters) == null ? void 0 : _b.length) > 0 ? setAccessorDecl.parameters[0].name : "arg";
50728
- const setAccessorSignature = factory.createSetAccessorDeclaration(
50729
- factory.createModifiersFromModifierFlags(flags),
50730
- propertyName,
50731
- [factory.createParameterDeclaration(
50732
- /*modifiers*/
50733
- void 0,
50734
- /*dotDotDotToken*/
50735
- void 0,
50736
- parameterName,
50737
- /*questionToken*/
50738
- void 0,
50739
- propertyTypeNode
50740
- )],
50741
- /*body*/
50742
- void 0
50743
- );
50744
- typeElements.push(preserveCommentsOn(setAccessorSignature));
50745
- }
50746
- } else {
50747
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
50748
- if (modifiers) {
50749
- context.approximateLength += 9;
50750
- }
50751
- const propertySignature = factory.createPropertySignature(
50752
- modifiers,
50753
- propertyName,
50754
- optionalToken,
50755
- propertyTypeNode
50756
- );
50757
- typeElements.push(preserveCommentsOn(propertySignature));
50711
+ const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
50712
+ if (modifiers) {
50713
+ context.approximateLength += 9;
50758
50714
  }
50715
+ const propertySignature = factory.createPropertySignature(
50716
+ modifiers,
50717
+ propertyName,
50718
+ optionalToken,
50719
+ propertyTypeNode
50720
+ );
50721
+ typeElements.push(preserveCommentsOn(propertySignature));
50759
50722
  function preserveCommentsOn(node) {
50760
50723
  var _a2;
50761
50724
  if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) {
@@ -61978,7 +61941,37 @@ ${lanes.join("\n")}
61978
61941
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
61979
61942
  for (let i = 0; i < paramCount; i++) {
61980
61943
  const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
61981
- const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61944
+ let targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61945
+ if (i === restIndex && targetType && sourceType && isTupleType(sourceType)) {
61946
+ targetType = mapType(targetType, (t) => {
61947
+ if (!isTupleType(t) || // When both sides are tuples of the same structure, we don't want to "propagate" types from elements of variable positions
61948
+ // to the following positions as that would disallow signatures of the exact same structures when trailing fixed elements are involved:
61949
+ //
61950
+ // let fn: (...rest: [...string[], number]) => void = (...rest: [...string[], number]) => {}; // ok
61951
+ //
61952
+ // Since we want to allow contextual types to flow into paremeters, we don't need to differentiate between rest and variadic elements
61953
+ // as that doesn't affect the contextual type of the parameter
61954
+ isTupleTypeStructureMatching(sourceType, t, 2 /* MatchVariable */)) {
61955
+ return t;
61956
+ }
61957
+ const elementTypes = [];
61958
+ const elementFlags = [];
61959
+ const sourceArity = getTypeReferenceArity(sourceType);
61960
+ const targetArity = getTypeReferenceArity(t);
61961
+ for (let i2 = 0; i2 < sourceArity; i2++) {
61962
+ if (i2 >= targetArity) {
61963
+ if (sourceType.target.elementFlags[i2] & 3 /* Fixed */) {
61964
+ elementTypes.push(undefinedType);
61965
+ elementFlags.push(sourceType.target.elementFlags[i2]);
61966
+ }
61967
+ continue;
61968
+ }
61969
+ elementTypes.push(getTupleElementType(t, i2));
61970
+ elementFlags.push(sourceType.target.elementFlags[i2]);
61971
+ }
61972
+ return createTupleType(elementTypes, elementFlags);
61973
+ });
61974
+ }
61982
61975
  if (sourceType && targetType) {
61983
61976
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
61984
61977
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -65161,8 +65154,11 @@ ${lanes.join("\n")}
65161
65154
  }
65162
65155
  return void 0;
65163
65156
  }
65164
- function isTupleTypeStructureMatching(t1, t2) {
65165
- return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f, i) => (f & 12 /* Variable */) === (t2.target.elementFlags[i] & 12 /* Variable */));
65157
+ function isTupleTypeStructureMatching(t1, t2, tupleStructureComparisonKind) {
65158
+ return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f1, i) => {
65159
+ const f2 = t2.target.elementFlags[i];
65160
+ return f1 === f2 || !!(tupleStructureComparisonKind & 1 /* MatchFixed */ && f1 & 3 /* Fixed */ && f2 & 3 /* Fixed */) || !!(tupleStructureComparisonKind & 2 /* MatchVariable */ && f1 & 12 /* Variable */ && f2 & 12 /* Variable */);
65161
+ });
65166
65162
  }
65167
65163
  function isZeroBigInt({ value }) {
65168
65164
  return value.base10Value === "0";
@@ -66358,7 +66354,7 @@ ${lanes.join("\n")}
66358
66354
  const targetArity = getTypeReferenceArity(target);
66359
66355
  const elementTypes = getTypeArguments(target);
66360
66356
  const elementFlags = target.target.elementFlags;
66361
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
66357
+ if (isTupleType(source) && isTupleTypeStructureMatching(source, target, 1 /* MatchFixed */)) {
66362
66358
  for (let i = 0; i < targetArity; i++) {
66363
66359
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
66364
66360
  }
@@ -131177,13 +131173,16 @@ ${lanes.join("\n")}
131177
131173
  return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
131178
131174
  }
131179
131175
  function getDefaultLikeExportNameFromDeclaration(symbol) {
131180
- return firstDefined(
131181
- symbol.declarations,
131182
- (d) => {
131183
- var _a, _b;
131184
- return isExportAssignment(d) ? (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text;
131176
+ return firstDefined(symbol.declarations, (d) => {
131177
+ var _a, _b, _c;
131178
+ if (isExportAssignment(d)) {
131179
+ return (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text;
131185
131180
  }
131186
- );
131181
+ if (isExportSpecifier(d) && d.symbol.flags === 2097152 /* Alias */) {
131182
+ return (_b = tryCast(d.propertyName, isIdentifier)) == null ? void 0 : _b.text;
131183
+ }
131184
+ return (_c = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _c.text;
131185
+ });
131187
131186
  }
131188
131187
  function getSymbolParentOrFail(symbol) {
131189
131188
  var _a;
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.2";
57
- var version = `${versionMajorMinor}.0-insiders.20230709`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230710`;
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.2.0-pr-54935-7",
5
+ "version": "5.2.0-pr-49218-24",
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": "4c1de3dcfe54b0cff2d2cfa69bc608b47083fe5b"
118
+ "gitHead": "f606b3c7639589dc74f8db612faba767e394c163"
119
119
  }