@typescript-deploys/pr-build 5.5.0-pr-58655-2 → 5.5.0-pr-58702-7

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.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240525`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240529`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -45032,9 +45032,6 @@ function createTypeChecker(host) {
45032
45032
  deferredDiagnosticsCallbacks.push(arg);
45033
45033
  };
45034
45034
  var cancellationToken;
45035
- var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
45036
- var requestedExternalEmitHelpers;
45037
- var externalHelpersModule;
45038
45035
  var scanner;
45039
45036
  var Symbol12 = objectAllocator.getSymbolConstructor();
45040
45037
  var Type7 = objectAllocator.getTypeConstructor();
@@ -53064,25 +53061,6 @@ function createTypeChecker(host) {
53064
53061
  function serializeSignatures(kind, input, baseType, outputKind) {
53065
53062
  const signatures = getSignaturesOfType(input, kind);
53066
53063
  if (kind === 1 /* Construct */) {
53067
- let privateProtected = 0;
53068
- for (const s of signatures) {
53069
- if (s.declaration) {
53070
- privateProtected |= getSelectedEffectiveModifierFlags(s.declaration, 2 /* Private */ | 4 /* Protected */);
53071
- }
53072
- }
53073
- if (privateProtected) {
53074
- return [setTextRange2(
53075
- context,
53076
- factory.createConstructorDeclaration(
53077
- factory.createModifiersFromModifierFlags(privateProtected),
53078
- /*parameters*/
53079
- [],
53080
- /*body*/
53081
- void 0
53082
- ),
53083
- signatures[0].declaration
53084
- )];
53085
- }
53086
53064
  if (!baseType && every(signatures, (s) => length(s.parameters) === 0)) {
53087
53065
  return [];
53088
53066
  }
@@ -53114,6 +53092,25 @@ function createTypeChecker(host) {
53114
53092
  }
53115
53093
  }
53116
53094
  }
53095
+ let privateProtected = 0;
53096
+ for (const s of signatures) {
53097
+ if (s.declaration) {
53098
+ privateProtected |= getSelectedEffectiveModifierFlags(s.declaration, 2 /* Private */ | 4 /* Protected */);
53099
+ }
53100
+ }
53101
+ if (privateProtected) {
53102
+ return [setTextRange2(
53103
+ context,
53104
+ factory.createConstructorDeclaration(
53105
+ factory.createModifiersFromModifierFlags(privateProtected),
53106
+ /*parameters*/
53107
+ [],
53108
+ /*body*/
53109
+ void 0
53110
+ ),
53111
+ signatures[0].declaration
53112
+ )];
53113
+ }
53117
53114
  }
53118
53115
  const results2 = [];
53119
53116
  for (const sig of signatures) {
@@ -59682,7 +59679,6 @@ function createTypeChecker(host) {
59682
59679
  return links.resolvedType;
59683
59680
  }
59684
59681
  function getTemplateLiteralType(texts, types) {
59685
- var _a, _b;
59686
59682
  const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
59687
59683
  if (unionIndex >= 0) {
59688
59684
  return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
@@ -59690,9 +59686,6 @@ function createTypeChecker(host) {
59690
59686
  if (contains(types, wildcardType)) {
59691
59687
  return wildcardType;
59692
59688
  }
59693
- if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (_a = types[0].symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b.some((d) => d.parent.kind === 195 /* InferType */)) && isTypeAssignableTo(types[0], stringType)) {
59694
- return types[0];
59695
- }
59696
59689
  const newTypes = [];
59697
59690
  const newTexts = [];
59698
59691
  let text = texts[0];
@@ -65747,12 +65740,17 @@ function createTypeChecker(host) {
65747
65740
  }
65748
65741
  }
65749
65742
  function applyToReturnTypes(source, target, callback) {
65750
- const sourceTypePredicate = getTypePredicateOfSignature(source);
65751
65743
  const targetTypePredicate = getTypePredicateOfSignature(target);
65752
- if (sourceTypePredicate && targetTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
65753
- callback(sourceTypePredicate.type, targetTypePredicate.type);
65754
- } else {
65755
- callback(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
65744
+ if (targetTypePredicate) {
65745
+ const sourceTypePredicate = getTypePredicateOfSignature(source);
65746
+ if (sourceTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
65747
+ callback(sourceTypePredicate.type, targetTypePredicate.type);
65748
+ return;
65749
+ }
65750
+ }
65751
+ const targetReturnType = getReturnTypeOfSignature(target);
65752
+ if (couldContainTypeVariables(targetReturnType)) {
65753
+ callback(getReturnTypeOfSignature(source), targetReturnType);
65756
65754
  }
65757
65755
  }
65758
65756
  function createInferenceContext(typeParameters, signature, flags, compareTypes) {
@@ -85413,38 +85411,40 @@ function createTypeChecker(host) {
85413
85411
  amalgamatedDuplicates = void 0;
85414
85412
  }
85415
85413
  function checkExternalEmitHelpers(location, helpers) {
85416
- if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
85414
+ if (compilerOptions.importHelpers) {
85417
85415
  const sourceFile = getSourceFileOfNode(location);
85418
85416
  if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 33554432 /* Ambient */)) {
85419
85417
  const helpersModule = resolveHelpersModule(sourceFile, location);
85420
85418
  if (helpersModule !== unknownSymbol) {
85421
- const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
85422
- for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
85423
- if (uncheckedHelpers & helper) {
85424
- for (const name of getHelperNames(helper)) {
85425
- if (requestedExternalEmitHelperNames.has(name)) continue;
85426
- requestedExternalEmitHelperNames.add(name);
85427
- const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
85428
- if (!symbol) {
85429
- error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
85430
- } else if (helper & 524288 /* ClassPrivateFieldGet */) {
85431
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
85432
- error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4);
85433
- }
85434
- } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
85435
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
85436
- error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5);
85437
- }
85438
- } else if (helper & 1024 /* SpreadArray */) {
85439
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
85440
- error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3);
85419
+ const links = getSymbolLinks(helpersModule);
85420
+ links.requestedExternalEmitHelpers ?? (links.requestedExternalEmitHelpers = 0);
85421
+ if ((links.requestedExternalEmitHelpers & helpers) !== helpers) {
85422
+ const uncheckedHelpers = helpers & ~links.requestedExternalEmitHelpers;
85423
+ for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
85424
+ if (uncheckedHelpers & helper) {
85425
+ for (const name of getHelperNames(helper)) {
85426
+ const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
85427
+ if (!symbol) {
85428
+ error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
85429
+ } else if (helper & 524288 /* ClassPrivateFieldGet */) {
85430
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
85431
+ error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4);
85432
+ }
85433
+ } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
85434
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
85435
+ error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5);
85436
+ }
85437
+ } else if (helper & 1024 /* SpreadArray */) {
85438
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
85439
+ error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3);
85440
+ }
85441
85441
  }
85442
85442
  }
85443
85443
  }
85444
85444
  }
85445
85445
  }
85446
+ links.requestedExternalEmitHelpers |= helpers;
85446
85447
  }
85447
- requestedExternalEmitHelpers |= helpers;
85448
85448
  }
85449
85449
  }
85450
85450
  }
@@ -85505,10 +85505,11 @@ function createTypeChecker(host) {
85505
85505
  }
85506
85506
  }
85507
85507
  function resolveHelpersModule(file, errorNode) {
85508
- if (!externalHelpersModule) {
85509
- externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
85508
+ const links = getNodeLinks(file);
85509
+ if (!links.externalHelpersModule) {
85510
+ links.externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
85510
85511
  }
85511
- return externalHelpersModule;
85512
+ return links.externalHelpersModule;
85512
85513
  }
85513
85514
  function checkGrammarModifiers(node) {
85514
85515
  var _a;
@@ -88898,8 +88899,8 @@ function collectExternalModuleInfo(context, sourceFile) {
88898
88899
  const exportSpecifiers = new IdentifierNameMultiMap();
88899
88900
  const exportedBindings = [];
88900
88901
  const uniqueExports = /* @__PURE__ */ new Map();
88902
+ const exportedFunctions = /* @__PURE__ */ new Set();
88901
88903
  let exportedNames;
88902
- let exportedFunctions;
88903
88904
  let hasExportDefault = false;
88904
88905
  let exportEquals;
88905
88906
  let hasExportStarsToExportValues = false;
@@ -88959,19 +88960,12 @@ function collectExternalModuleInfo(context, sourceFile) {
88959
88960
  break;
88960
88961
  case 262 /* FunctionDeclaration */:
88961
88962
  if (hasSyntacticModifier(node, 32 /* Export */)) {
88962
- exportedFunctions = append(exportedFunctions, node);
88963
- if (hasSyntacticModifier(node, 2048 /* Default */)) {
88964
- if (!hasExportDefault) {
88965
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
88966
- hasExportDefault = true;
88967
- }
88968
- } else {
88969
- const name = node.name;
88970
- if (!uniqueExports.get(idText(name))) {
88971
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
88972
- uniqueExports.set(idText(name), true);
88973
- }
88974
- }
88963
+ addExportedFunctionDeclaration(
88964
+ node,
88965
+ /*name*/
88966
+ void 0,
88967
+ hasSyntacticModifier(node, 2048 /* Default */)
88968
+ );
88975
88969
  }
88976
88970
  break;
88977
88971
  case 263 /* ClassDeclaration */:
@@ -89007,6 +89001,10 @@ function collectExternalModuleInfo(context, sourceFile) {
89007
89001
  }
89008
89002
  const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
89009
89003
  if (decl) {
89004
+ if (decl.kind === 262 /* FunctionDeclaration */) {
89005
+ addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
89006
+ continue;
89007
+ }
89010
89008
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
89011
89009
  }
89012
89010
  uniqueExports.set(idText(specifier.name), true);
@@ -89014,6 +89012,21 @@ function collectExternalModuleInfo(context, sourceFile) {
89014
89012
  }
89015
89013
  }
89016
89014
  }
89015
+ function addExportedFunctionDeclaration(node, name, isDefault) {
89016
+ exportedFunctions.add(node);
89017
+ if (isDefault) {
89018
+ if (!hasExportDefault) {
89019
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
89020
+ hasExportDefault = true;
89021
+ }
89022
+ } else {
89023
+ name ?? (name = node.name);
89024
+ if (!uniqueExports.get(idText(name))) {
89025
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
89026
+ uniqueExports.set(idText(name), true);
89027
+ }
89028
+ }
89029
+ }
89017
89030
  }
89018
89031
  function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) {
89019
89032
  if (isBindingPattern(decl.name)) {
@@ -106296,10 +106309,8 @@ function transformModule(context) {
106296
106309
  );
106297
106310
  }
106298
106311
  }
106299
- if (some(currentModuleInfo.exportedFunctions)) {
106300
- for (const f of currentModuleInfo.exportedFunctions) {
106301
- appendExportsOfHoistedDeclaration(statements, f);
106302
- }
106312
+ for (const f of currentModuleInfo.exportedFunctions) {
106313
+ appendExportsOfHoistedDeclaration(statements, f);
106303
106314
  }
106304
106315
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
106305
106316
  addRange(statements, visitNodes2(node.statements, topLevelVisitor, isStatement, statementOffset));
@@ -106616,10 +106627,8 @@ function transformModule(context) {
106616
106627
  if (some(currentModuleInfo.exportedNames)) {
106617
106628
  append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
106618
106629
  }
106619
- if (some(currentModuleInfo.exportedFunctions)) {
106620
- for (const f of currentModuleInfo.exportedFunctions) {
106621
- appendExportsOfHoistedDeclaration(statements, f);
106622
- }
106630
+ for (const f of currentModuleInfo.exportedFunctions) {
106631
+ appendExportsOfHoistedDeclaration(statements, f);
106623
106632
  }
106624
106633
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
106625
106634
  if (moduleKind === 2 /* AMD */) {
@@ -108333,7 +108342,7 @@ function transformSystemModule(context) {
108333
108342
  if (!moduleInfo.hasExportStarsToExportValues) {
108334
108343
  return;
108335
108344
  }
108336
- if (!some(moduleInfo.exportedNames) && !some(moduleInfo.exportedFunctions) && moduleInfo.exportSpecifiers.size === 0) {
108345
+ if (!some(moduleInfo.exportedNames) && moduleInfo.exportedFunctions.size === 0 && moduleInfo.exportSpecifiers.size === 0) {
108337
108346
  let hasExportDeclarationWithExportClause = false;
108338
108347
  for (const externalImport of moduleInfo.externalImports) {
108339
108348
  if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) {
@@ -108364,19 +108373,17 @@ function transformSystemModule(context) {
108364
108373
  );
108365
108374
  }
108366
108375
  }
108367
- if (moduleInfo.exportedFunctions) {
108368
- for (const f of moduleInfo.exportedFunctions) {
108369
- if (hasSyntacticModifier(f, 2048 /* Default */)) {
108370
- continue;
108371
- }
108372
- Debug.assert(!!f.name);
108373
- exportedNames.push(
108374
- factory2.createPropertyAssignment(
108375
- factory2.createStringLiteralFromNode(f.name),
108376
- factory2.createTrue()
108377
- )
108378
- );
108376
+ for (const f of moduleInfo.exportedFunctions) {
108377
+ if (hasSyntacticModifier(f, 2048 /* Default */)) {
108378
+ continue;
108379
108379
  }
108380
+ Debug.assert(!!f.name);
108381
+ exportedNames.push(
108382
+ factory2.createPropertyAssignment(
108383
+ factory2.createStringLiteralFromNode(f.name),
108384
+ factory2.createTrue()
108385
+ )
108386
+ );
108380
108387
  }
108381
108388
  const exportedNamesStorageRef = factory2.createUniqueName("exportedNames");
108382
108389
  statements.push(
package/lib/typescript.js CHANGED
@@ -2370,7 +2370,7 @@ module.exports = __toCommonJS(typescript_exports);
2370
2370
 
2371
2371
  // src/compiler/corePublic.ts
2372
2372
  var versionMajorMinor = "5.5";
2373
- var version = `${versionMajorMinor}.0-insiders.20240525`;
2373
+ var version = `${versionMajorMinor}.0-insiders.20240529`;
2374
2374
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2375
2375
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2376
2376
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -49827,9 +49827,6 @@ function createTypeChecker(host) {
49827
49827
  deferredDiagnosticsCallbacks.push(arg);
49828
49828
  };
49829
49829
  var cancellationToken;
49830
- var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
49831
- var requestedExternalEmitHelpers;
49832
- var externalHelpersModule;
49833
49830
  var scanner2;
49834
49831
  var Symbol47 = objectAllocator.getSymbolConstructor();
49835
49832
  var Type29 = objectAllocator.getTypeConstructor();
@@ -57859,25 +57856,6 @@ function createTypeChecker(host) {
57859
57856
  function serializeSignatures(kind, input, baseType, outputKind) {
57860
57857
  const signatures = getSignaturesOfType(input, kind);
57861
57858
  if (kind === 1 /* Construct */) {
57862
- let privateProtected = 0;
57863
- for (const s of signatures) {
57864
- if (s.declaration) {
57865
- privateProtected |= getSelectedEffectiveModifierFlags(s.declaration, 2 /* Private */ | 4 /* Protected */);
57866
- }
57867
- }
57868
- if (privateProtected) {
57869
- return [setTextRange2(
57870
- context,
57871
- factory.createConstructorDeclaration(
57872
- factory.createModifiersFromModifierFlags(privateProtected),
57873
- /*parameters*/
57874
- [],
57875
- /*body*/
57876
- void 0
57877
- ),
57878
- signatures[0].declaration
57879
- )];
57880
- }
57881
57859
  if (!baseType && every(signatures, (s) => length(s.parameters) === 0)) {
57882
57860
  return [];
57883
57861
  }
@@ -57909,6 +57887,25 @@ function createTypeChecker(host) {
57909
57887
  }
57910
57888
  }
57911
57889
  }
57890
+ let privateProtected = 0;
57891
+ for (const s of signatures) {
57892
+ if (s.declaration) {
57893
+ privateProtected |= getSelectedEffectiveModifierFlags(s.declaration, 2 /* Private */ | 4 /* Protected */);
57894
+ }
57895
+ }
57896
+ if (privateProtected) {
57897
+ return [setTextRange2(
57898
+ context,
57899
+ factory.createConstructorDeclaration(
57900
+ factory.createModifiersFromModifierFlags(privateProtected),
57901
+ /*parameters*/
57902
+ [],
57903
+ /*body*/
57904
+ void 0
57905
+ ),
57906
+ signatures[0].declaration
57907
+ )];
57908
+ }
57912
57909
  }
57913
57910
  const results2 = [];
57914
57911
  for (const sig of signatures) {
@@ -64477,7 +64474,6 @@ function createTypeChecker(host) {
64477
64474
  return links.resolvedType;
64478
64475
  }
64479
64476
  function getTemplateLiteralType(texts, types) {
64480
- var _a, _b;
64481
64477
  const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
64482
64478
  if (unionIndex >= 0) {
64483
64479
  return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
@@ -64485,9 +64481,6 @@ function createTypeChecker(host) {
64485
64481
  if (contains(types, wildcardType)) {
64486
64482
  return wildcardType;
64487
64483
  }
64488
- if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (_a = types[0].symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b.some((d) => d.parent.kind === 195 /* InferType */)) && isTypeAssignableTo(types[0], stringType)) {
64489
- return types[0];
64490
- }
64491
64484
  const newTypes = [];
64492
64485
  const newTexts = [];
64493
64486
  let text = texts[0];
@@ -70542,12 +70535,17 @@ function createTypeChecker(host) {
70542
70535
  }
70543
70536
  }
70544
70537
  function applyToReturnTypes(source, target, callback) {
70545
- const sourceTypePredicate = getTypePredicateOfSignature(source);
70546
70538
  const targetTypePredicate = getTypePredicateOfSignature(target);
70547
- if (sourceTypePredicate && targetTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
70548
- callback(sourceTypePredicate.type, targetTypePredicate.type);
70549
- } else {
70550
- callback(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
70539
+ if (targetTypePredicate) {
70540
+ const sourceTypePredicate = getTypePredicateOfSignature(source);
70541
+ if (sourceTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
70542
+ callback(sourceTypePredicate.type, targetTypePredicate.type);
70543
+ return;
70544
+ }
70545
+ }
70546
+ const targetReturnType = getReturnTypeOfSignature(target);
70547
+ if (couldContainTypeVariables(targetReturnType)) {
70548
+ callback(getReturnTypeOfSignature(source), targetReturnType);
70551
70549
  }
70552
70550
  }
70553
70551
  function createInferenceContext(typeParameters, signature, flags, compareTypes) {
@@ -90208,38 +90206,40 @@ function createTypeChecker(host) {
90208
90206
  amalgamatedDuplicates = void 0;
90209
90207
  }
90210
90208
  function checkExternalEmitHelpers(location, helpers) {
90211
- if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
90209
+ if (compilerOptions.importHelpers) {
90212
90210
  const sourceFile = getSourceFileOfNode(location);
90213
90211
  if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 33554432 /* Ambient */)) {
90214
90212
  const helpersModule = resolveHelpersModule(sourceFile, location);
90215
90213
  if (helpersModule !== unknownSymbol) {
90216
- const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
90217
- for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
90218
- if (uncheckedHelpers & helper) {
90219
- for (const name of getHelperNames(helper)) {
90220
- if (requestedExternalEmitHelperNames.has(name)) continue;
90221
- requestedExternalEmitHelperNames.add(name);
90222
- const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
90223
- if (!symbol) {
90224
- error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
90225
- } else if (helper & 524288 /* ClassPrivateFieldGet */) {
90226
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
90227
- error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4);
90228
- }
90229
- } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
90230
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
90231
- error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5);
90232
- }
90233
- } else if (helper & 1024 /* SpreadArray */) {
90234
- if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
90235
- error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3);
90214
+ const links = getSymbolLinks(helpersModule);
90215
+ links.requestedExternalEmitHelpers ?? (links.requestedExternalEmitHelpers = 0);
90216
+ if ((links.requestedExternalEmitHelpers & helpers) !== helpers) {
90217
+ const uncheckedHelpers = helpers & ~links.requestedExternalEmitHelpers;
90218
+ for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
90219
+ if (uncheckedHelpers & helper) {
90220
+ for (const name of getHelperNames(helper)) {
90221
+ const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
90222
+ if (!symbol) {
90223
+ error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
90224
+ } else if (helper & 524288 /* ClassPrivateFieldGet */) {
90225
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
90226
+ error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4);
90227
+ }
90228
+ } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
90229
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
90230
+ error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5);
90231
+ }
90232
+ } else if (helper & 1024 /* SpreadArray */) {
90233
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
90234
+ error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3);
90235
+ }
90236
90236
  }
90237
90237
  }
90238
90238
  }
90239
90239
  }
90240
90240
  }
90241
+ links.requestedExternalEmitHelpers |= helpers;
90241
90242
  }
90242
- requestedExternalEmitHelpers |= helpers;
90243
90243
  }
90244
90244
  }
90245
90245
  }
@@ -90300,10 +90300,11 @@ function createTypeChecker(host) {
90300
90300
  }
90301
90301
  }
90302
90302
  function resolveHelpersModule(file, errorNode) {
90303
- if (!externalHelpersModule) {
90304
- externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
90303
+ const links = getNodeLinks(file);
90304
+ if (!links.externalHelpersModule) {
90305
+ links.externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
90305
90306
  }
90306
- return externalHelpersModule;
90307
+ return links.externalHelpersModule;
90307
90308
  }
90308
90309
  function checkGrammarModifiers(node) {
90309
90310
  var _a;
@@ -93865,8 +93866,8 @@ function collectExternalModuleInfo(context, sourceFile) {
93865
93866
  const exportSpecifiers = new IdentifierNameMultiMap();
93866
93867
  const exportedBindings = [];
93867
93868
  const uniqueExports = /* @__PURE__ */ new Map();
93869
+ const exportedFunctions = /* @__PURE__ */ new Set();
93868
93870
  let exportedNames;
93869
- let exportedFunctions;
93870
93871
  let hasExportDefault = false;
93871
93872
  let exportEquals;
93872
93873
  let hasExportStarsToExportValues = false;
@@ -93926,19 +93927,12 @@ function collectExternalModuleInfo(context, sourceFile) {
93926
93927
  break;
93927
93928
  case 262 /* FunctionDeclaration */:
93928
93929
  if (hasSyntacticModifier(node, 32 /* Export */)) {
93929
- exportedFunctions = append(exportedFunctions, node);
93930
- if (hasSyntacticModifier(node, 2048 /* Default */)) {
93931
- if (!hasExportDefault) {
93932
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
93933
- hasExportDefault = true;
93934
- }
93935
- } else {
93936
- const name = node.name;
93937
- if (!uniqueExports.get(idText(name))) {
93938
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
93939
- uniqueExports.set(idText(name), true);
93940
- }
93941
- }
93930
+ addExportedFunctionDeclaration(
93931
+ node,
93932
+ /*name*/
93933
+ void 0,
93934
+ hasSyntacticModifier(node, 2048 /* Default */)
93935
+ );
93942
93936
  }
93943
93937
  break;
93944
93938
  case 263 /* ClassDeclaration */:
@@ -93974,6 +93968,10 @@ function collectExternalModuleInfo(context, sourceFile) {
93974
93968
  }
93975
93969
  const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
93976
93970
  if (decl) {
93971
+ if (decl.kind === 262 /* FunctionDeclaration */) {
93972
+ addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
93973
+ continue;
93974
+ }
93977
93975
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
93978
93976
  }
93979
93977
  uniqueExports.set(idText(specifier.name), true);
@@ -93981,6 +93979,21 @@ function collectExternalModuleInfo(context, sourceFile) {
93981
93979
  }
93982
93980
  }
93983
93981
  }
93982
+ function addExportedFunctionDeclaration(node, name, isDefault) {
93983
+ exportedFunctions.add(node);
93984
+ if (isDefault) {
93985
+ if (!hasExportDefault) {
93986
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
93987
+ hasExportDefault = true;
93988
+ }
93989
+ } else {
93990
+ name ?? (name = node.name);
93991
+ if (!uniqueExports.get(idText(name))) {
93992
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
93993
+ uniqueExports.set(idText(name), true);
93994
+ }
93995
+ }
93996
+ }
93984
93997
  }
93985
93998
  function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) {
93986
93999
  if (isBindingPattern(decl.name)) {
@@ -111273,10 +111286,8 @@ function transformModule(context) {
111273
111286
  );
111274
111287
  }
111275
111288
  }
111276
- if (some(currentModuleInfo.exportedFunctions)) {
111277
- for (const f of currentModuleInfo.exportedFunctions) {
111278
- appendExportsOfHoistedDeclaration(statements, f);
111279
- }
111289
+ for (const f of currentModuleInfo.exportedFunctions) {
111290
+ appendExportsOfHoistedDeclaration(statements, f);
111280
111291
  }
111281
111292
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
111282
111293
  addRange(statements, visitNodes2(node.statements, topLevelVisitor, isStatement, statementOffset));
@@ -111593,10 +111604,8 @@ function transformModule(context) {
111593
111604
  if (some(currentModuleInfo.exportedNames)) {
111594
111605
  append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
111595
111606
  }
111596
- if (some(currentModuleInfo.exportedFunctions)) {
111597
- for (const f of currentModuleInfo.exportedFunctions) {
111598
- appendExportsOfHoistedDeclaration(statements, f);
111599
- }
111607
+ for (const f of currentModuleInfo.exportedFunctions) {
111608
+ appendExportsOfHoistedDeclaration(statements, f);
111600
111609
  }
111601
111610
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
111602
111611
  if (moduleKind === 2 /* AMD */) {
@@ -113310,7 +113319,7 @@ function transformSystemModule(context) {
113310
113319
  if (!moduleInfo.hasExportStarsToExportValues) {
113311
113320
  return;
113312
113321
  }
113313
- if (!some(moduleInfo.exportedNames) && !some(moduleInfo.exportedFunctions) && moduleInfo.exportSpecifiers.size === 0) {
113322
+ if (!some(moduleInfo.exportedNames) && moduleInfo.exportedFunctions.size === 0 && moduleInfo.exportSpecifiers.size === 0) {
113314
113323
  let hasExportDeclarationWithExportClause = false;
113315
113324
  for (const externalImport of moduleInfo.externalImports) {
113316
113325
  if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) {
@@ -113341,19 +113350,17 @@ function transformSystemModule(context) {
113341
113350
  );
113342
113351
  }
113343
113352
  }
113344
- if (moduleInfo.exportedFunctions) {
113345
- for (const f of moduleInfo.exportedFunctions) {
113346
- if (hasSyntacticModifier(f, 2048 /* Default */)) {
113347
- continue;
113348
- }
113349
- Debug.assert(!!f.name);
113350
- exportedNames.push(
113351
- factory2.createPropertyAssignment(
113352
- factory2.createStringLiteralFromNode(f.name),
113353
- factory2.createTrue()
113354
- )
113355
- );
113353
+ for (const f of moduleInfo.exportedFunctions) {
113354
+ if (hasSyntacticModifier(f, 2048 /* Default */)) {
113355
+ continue;
113356
113356
  }
113357
+ Debug.assert(!!f.name);
113358
+ exportedNames.push(
113359
+ factory2.createPropertyAssignment(
113360
+ factory2.createStringLiteralFromNode(f.name),
113361
+ factory2.createTrue()
113362
+ )
113363
+ );
113357
113364
  }
113358
113365
  const exportedNamesStorageRef = factory2.createUniqueName("exportedNames");
113359
113366
  statements.push(
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.5.0-pr-58655-2",
5
+ "version": "5.5.0-pr-58702-7",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [