@typescript-deploys/pr-build 5.5.0-pr-58655-2 → 5.5.0-pr-58703-2

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.
Files changed (3) hide show
  1. package/lib/tsc.js +111 -90
  2. package/lib/typescript.js +111 -90
  3. package/package.json +1 -1
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,7 +59686,7 @@ 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)) {
59689
+ if (texts.length === 2 && texts[0] === "" && texts[1] === "" && types[0].flags & 268435456 /* StringMapping */) {
59694
59690
  return types[0];
59695
59691
  }
59696
59692
  const newTypes = [];
@@ -65747,12 +65743,17 @@ function createTypeChecker(host) {
65747
65743
  }
65748
65744
  }
65749
65745
  function applyToReturnTypes(source, target, callback) {
65750
- const sourceTypePredicate = getTypePredicateOfSignature(source);
65751
65746
  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));
65747
+ if (targetTypePredicate) {
65748
+ const sourceTypePredicate = getTypePredicateOfSignature(source);
65749
+ if (sourceTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
65750
+ callback(sourceTypePredicate.type, targetTypePredicate.type);
65751
+ return;
65752
+ }
65753
+ }
65754
+ const targetReturnType = getReturnTypeOfSignature(target);
65755
+ if (couldContainTypeVariables(targetReturnType)) {
65756
+ callback(getReturnTypeOfSignature(source), targetReturnType);
65756
65757
  }
65757
65758
  }
65758
65759
  function createInferenceContext(typeParameters, signature, flags, compareTypes) {
@@ -66067,6 +66068,13 @@ function createTypeChecker(host) {
66067
66068
  }
66068
66069
  return false;
66069
66070
  }
66071
+ function isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(type) {
66072
+ if (!(type.flags & 134217728 /* TemplateLiteral */)) {
66073
+ return false;
66074
+ }
66075
+ const texts = type.texts;
66076
+ return texts.length === 2 && texts[0] === "" && texts[1] === "";
66077
+ }
66070
66078
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
66071
66079
  if (target.flags & 2097152 /* Intersection */) {
66072
66080
  return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
@@ -66546,6 +66554,10 @@ function createTypeChecker(host) {
66546
66554
  }
66547
66555
  }
66548
66556
  function inferToTemplateLiteralType(source, target) {
66557
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source) && isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(target)) {
66558
+ inferFromTypes(source.types[0], target.types[0]);
66559
+ return;
66560
+ }
66549
66561
  const matches = inferTypesFromTemplateLiteralType(source, target);
66550
66562
  const types = target.types;
66551
66563
  if (matches || every(target.texts, (s) => s.length === 0)) {
@@ -85413,38 +85425,40 @@ function createTypeChecker(host) {
85413
85425
  amalgamatedDuplicates = void 0;
85414
85426
  }
85415
85427
  function checkExternalEmitHelpers(location, helpers) {
85416
- if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
85428
+ if (compilerOptions.importHelpers) {
85417
85429
  const sourceFile = getSourceFileOfNode(location);
85418
85430
  if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 33554432 /* Ambient */)) {
85419
85431
  const helpersModule = resolveHelpersModule(sourceFile, location);
85420
85432
  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);
85433
+ const links = getSymbolLinks(helpersModule);
85434
+ links.requestedExternalEmitHelpers ?? (links.requestedExternalEmitHelpers = 0);
85435
+ if ((links.requestedExternalEmitHelpers & helpers) !== helpers) {
85436
+ const uncheckedHelpers = helpers & ~links.requestedExternalEmitHelpers;
85437
+ for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
85438
+ if (uncheckedHelpers & helper) {
85439
+ for (const name of getHelperNames(helper)) {
85440
+ const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
85441
+ if (!symbol) {
85442
+ 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);
85443
+ } else if (helper & 524288 /* ClassPrivateFieldGet */) {
85444
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
85445
+ 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);
85446
+ }
85447
+ } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
85448
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
85449
+ 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);
85450
+ }
85451
+ } else if (helper & 1024 /* SpreadArray */) {
85452
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
85453
+ 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);
85454
+ }
85441
85455
  }
85442
85456
  }
85443
85457
  }
85444
85458
  }
85445
85459
  }
85460
+ links.requestedExternalEmitHelpers |= helpers;
85446
85461
  }
85447
- requestedExternalEmitHelpers |= helpers;
85448
85462
  }
85449
85463
  }
85450
85464
  }
@@ -85505,10 +85519,11 @@ function createTypeChecker(host) {
85505
85519
  }
85506
85520
  }
85507
85521
  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;
85522
+ const links = getNodeLinks(file);
85523
+ if (!links.externalHelpersModule) {
85524
+ links.externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
85510
85525
  }
85511
- return externalHelpersModule;
85526
+ return links.externalHelpersModule;
85512
85527
  }
85513
85528
  function checkGrammarModifiers(node) {
85514
85529
  var _a;
@@ -88898,8 +88913,8 @@ function collectExternalModuleInfo(context, sourceFile) {
88898
88913
  const exportSpecifiers = new IdentifierNameMultiMap();
88899
88914
  const exportedBindings = [];
88900
88915
  const uniqueExports = /* @__PURE__ */ new Map();
88916
+ const exportedFunctions = /* @__PURE__ */ new Set();
88901
88917
  let exportedNames;
88902
- let exportedFunctions;
88903
88918
  let hasExportDefault = false;
88904
88919
  let exportEquals;
88905
88920
  let hasExportStarsToExportValues = false;
@@ -88959,19 +88974,12 @@ function collectExternalModuleInfo(context, sourceFile) {
88959
88974
  break;
88960
88975
  case 262 /* FunctionDeclaration */:
88961
88976
  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
- }
88977
+ addExportedFunctionDeclaration(
88978
+ node,
88979
+ /*name*/
88980
+ void 0,
88981
+ hasSyntacticModifier(node, 2048 /* Default */)
88982
+ );
88975
88983
  }
88976
88984
  break;
88977
88985
  case 263 /* ClassDeclaration */:
@@ -89007,6 +89015,10 @@ function collectExternalModuleInfo(context, sourceFile) {
89007
89015
  }
89008
89016
  const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
89009
89017
  if (decl) {
89018
+ if (decl.kind === 262 /* FunctionDeclaration */) {
89019
+ addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
89020
+ continue;
89021
+ }
89010
89022
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
89011
89023
  }
89012
89024
  uniqueExports.set(idText(specifier.name), true);
@@ -89014,6 +89026,21 @@ function collectExternalModuleInfo(context, sourceFile) {
89014
89026
  }
89015
89027
  }
89016
89028
  }
89029
+ function addExportedFunctionDeclaration(node, name, isDefault) {
89030
+ exportedFunctions.add(node);
89031
+ if (isDefault) {
89032
+ if (!hasExportDefault) {
89033
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
89034
+ hasExportDefault = true;
89035
+ }
89036
+ } else {
89037
+ name ?? (name = node.name);
89038
+ if (!uniqueExports.get(idText(name))) {
89039
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
89040
+ uniqueExports.set(idText(name), true);
89041
+ }
89042
+ }
89043
+ }
89017
89044
  }
89018
89045
  function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) {
89019
89046
  if (isBindingPattern(decl.name)) {
@@ -106296,10 +106323,8 @@ function transformModule(context) {
106296
106323
  );
106297
106324
  }
106298
106325
  }
106299
- if (some(currentModuleInfo.exportedFunctions)) {
106300
- for (const f of currentModuleInfo.exportedFunctions) {
106301
- appendExportsOfHoistedDeclaration(statements, f);
106302
- }
106326
+ for (const f of currentModuleInfo.exportedFunctions) {
106327
+ appendExportsOfHoistedDeclaration(statements, f);
106303
106328
  }
106304
106329
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
106305
106330
  addRange(statements, visitNodes2(node.statements, topLevelVisitor, isStatement, statementOffset));
@@ -106616,10 +106641,8 @@ function transformModule(context) {
106616
106641
  if (some(currentModuleInfo.exportedNames)) {
106617
106642
  append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
106618
106643
  }
106619
- if (some(currentModuleInfo.exportedFunctions)) {
106620
- for (const f of currentModuleInfo.exportedFunctions) {
106621
- appendExportsOfHoistedDeclaration(statements, f);
106622
- }
106644
+ for (const f of currentModuleInfo.exportedFunctions) {
106645
+ appendExportsOfHoistedDeclaration(statements, f);
106623
106646
  }
106624
106647
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
106625
106648
  if (moduleKind === 2 /* AMD */) {
@@ -108333,7 +108356,7 @@ function transformSystemModule(context) {
108333
108356
  if (!moduleInfo.hasExportStarsToExportValues) {
108334
108357
  return;
108335
108358
  }
108336
- if (!some(moduleInfo.exportedNames) && !some(moduleInfo.exportedFunctions) && moduleInfo.exportSpecifiers.size === 0) {
108359
+ if (!some(moduleInfo.exportedNames) && moduleInfo.exportedFunctions.size === 0 && moduleInfo.exportSpecifiers.size === 0) {
108337
108360
  let hasExportDeclarationWithExportClause = false;
108338
108361
  for (const externalImport of moduleInfo.externalImports) {
108339
108362
  if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) {
@@ -108364,19 +108387,17 @@ function transformSystemModule(context) {
108364
108387
  );
108365
108388
  }
108366
108389
  }
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
- );
108390
+ for (const f of moduleInfo.exportedFunctions) {
108391
+ if (hasSyntacticModifier(f, 2048 /* Default */)) {
108392
+ continue;
108379
108393
  }
108394
+ Debug.assert(!!f.name);
108395
+ exportedNames.push(
108396
+ factory2.createPropertyAssignment(
108397
+ factory2.createStringLiteralFromNode(f.name),
108398
+ factory2.createTrue()
108399
+ )
108400
+ );
108380
108401
  }
108381
108402
  const exportedNamesStorageRef = factory2.createUniqueName("exportedNames");
108382
108403
  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,7 +64481,7 @@ 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)) {
64484
+ if (texts.length === 2 && texts[0] === "" && texts[1] === "" && types[0].flags & 268435456 /* StringMapping */) {
64489
64485
  return types[0];
64490
64486
  }
64491
64487
  const newTypes = [];
@@ -70542,12 +70538,17 @@ function createTypeChecker(host) {
70542
70538
  }
70543
70539
  }
70544
70540
  function applyToReturnTypes(source, target, callback) {
70545
- const sourceTypePredicate = getTypePredicateOfSignature(source);
70546
70541
  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));
70542
+ if (targetTypePredicate) {
70543
+ const sourceTypePredicate = getTypePredicateOfSignature(source);
70544
+ if (sourceTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
70545
+ callback(sourceTypePredicate.type, targetTypePredicate.type);
70546
+ return;
70547
+ }
70548
+ }
70549
+ const targetReturnType = getReturnTypeOfSignature(target);
70550
+ if (couldContainTypeVariables(targetReturnType)) {
70551
+ callback(getReturnTypeOfSignature(source), targetReturnType);
70551
70552
  }
70552
70553
  }
70553
70554
  function createInferenceContext(typeParameters, signature, flags, compareTypes) {
@@ -70862,6 +70863,13 @@ function createTypeChecker(host) {
70862
70863
  }
70863
70864
  return false;
70864
70865
  }
70866
+ function isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(type) {
70867
+ if (!(type.flags & 134217728 /* TemplateLiteral */)) {
70868
+ return false;
70869
+ }
70870
+ const texts = type.texts;
70871
+ return texts.length === 2 && texts[0] === "" && texts[1] === "";
70872
+ }
70865
70873
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
70866
70874
  if (target.flags & 2097152 /* Intersection */) {
70867
70875
  return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
@@ -71341,6 +71349,10 @@ function createTypeChecker(host) {
71341
71349
  }
71342
71350
  }
71343
71351
  function inferToTemplateLiteralType(source, target) {
71352
+ if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source) && isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(target)) {
71353
+ inferFromTypes(source.types[0], target.types[0]);
71354
+ return;
71355
+ }
71344
71356
  const matches = inferTypesFromTemplateLiteralType(source, target);
71345
71357
  const types = target.types;
71346
71358
  if (matches || every(target.texts, (s) => s.length === 0)) {
@@ -90208,38 +90220,40 @@ function createTypeChecker(host) {
90208
90220
  amalgamatedDuplicates = void 0;
90209
90221
  }
90210
90222
  function checkExternalEmitHelpers(location, helpers) {
90211
- if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
90223
+ if (compilerOptions.importHelpers) {
90212
90224
  const sourceFile = getSourceFileOfNode(location);
90213
90225
  if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 33554432 /* Ambient */)) {
90214
90226
  const helpersModule = resolveHelpersModule(sourceFile, location);
90215
90227
  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);
90228
+ const links = getSymbolLinks(helpersModule);
90229
+ links.requestedExternalEmitHelpers ?? (links.requestedExternalEmitHelpers = 0);
90230
+ if ((links.requestedExternalEmitHelpers & helpers) !== helpers) {
90231
+ const uncheckedHelpers = helpers & ~links.requestedExternalEmitHelpers;
90232
+ for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) {
90233
+ if (uncheckedHelpers & helper) {
90234
+ for (const name of getHelperNames(helper)) {
90235
+ const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
90236
+ if (!symbol) {
90237
+ 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);
90238
+ } else if (helper & 524288 /* ClassPrivateFieldGet */) {
90239
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) {
90240
+ 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);
90241
+ }
90242
+ } else if (helper & 1048576 /* ClassPrivateFieldSet */) {
90243
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) {
90244
+ 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);
90245
+ }
90246
+ } else if (helper & 1024 /* SpreadArray */) {
90247
+ if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) {
90248
+ 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);
90249
+ }
90236
90250
  }
90237
90251
  }
90238
90252
  }
90239
90253
  }
90240
90254
  }
90255
+ links.requestedExternalEmitHelpers |= helpers;
90241
90256
  }
90242
- requestedExternalEmitHelpers |= helpers;
90243
90257
  }
90244
90258
  }
90245
90259
  }
@@ -90300,10 +90314,11 @@ function createTypeChecker(host) {
90300
90314
  }
90301
90315
  }
90302
90316
  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;
90317
+ const links = getNodeLinks(file);
90318
+ if (!links.externalHelpersModule) {
90319
+ links.externalHelpersModule = resolveExternalModule(getImportHelpersImportSpecifier(file), externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
90305
90320
  }
90306
- return externalHelpersModule;
90321
+ return links.externalHelpersModule;
90307
90322
  }
90308
90323
  function checkGrammarModifiers(node) {
90309
90324
  var _a;
@@ -93865,8 +93880,8 @@ function collectExternalModuleInfo(context, sourceFile) {
93865
93880
  const exportSpecifiers = new IdentifierNameMultiMap();
93866
93881
  const exportedBindings = [];
93867
93882
  const uniqueExports = /* @__PURE__ */ new Map();
93883
+ const exportedFunctions = /* @__PURE__ */ new Set();
93868
93884
  let exportedNames;
93869
- let exportedFunctions;
93870
93885
  let hasExportDefault = false;
93871
93886
  let exportEquals;
93872
93887
  let hasExportStarsToExportValues = false;
@@ -93926,19 +93941,12 @@ function collectExternalModuleInfo(context, sourceFile) {
93926
93941
  break;
93927
93942
  case 262 /* FunctionDeclaration */:
93928
93943
  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
- }
93944
+ addExportedFunctionDeclaration(
93945
+ node,
93946
+ /*name*/
93947
+ void 0,
93948
+ hasSyntacticModifier(node, 2048 /* Default */)
93949
+ );
93942
93950
  }
93943
93951
  break;
93944
93952
  case 263 /* ClassDeclaration */:
@@ -93974,6 +93982,10 @@ function collectExternalModuleInfo(context, sourceFile) {
93974
93982
  }
93975
93983
  const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
93976
93984
  if (decl) {
93985
+ if (decl.kind === 262 /* FunctionDeclaration */) {
93986
+ addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
93987
+ continue;
93988
+ }
93977
93989
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
93978
93990
  }
93979
93991
  uniqueExports.set(idText(specifier.name), true);
@@ -93981,6 +93993,21 @@ function collectExternalModuleInfo(context, sourceFile) {
93981
93993
  }
93982
93994
  }
93983
93995
  }
93996
+ function addExportedFunctionDeclaration(node, name, isDefault) {
93997
+ exportedFunctions.add(node);
93998
+ if (isDefault) {
93999
+ if (!hasExportDefault) {
94000
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
94001
+ hasExportDefault = true;
94002
+ }
94003
+ } else {
94004
+ name ?? (name = node.name);
94005
+ if (!uniqueExports.get(idText(name))) {
94006
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
94007
+ uniqueExports.set(idText(name), true);
94008
+ }
94009
+ }
94010
+ }
93984
94011
  }
93985
94012
  function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) {
93986
94013
  if (isBindingPattern(decl.name)) {
@@ -111273,10 +111300,8 @@ function transformModule(context) {
111273
111300
  );
111274
111301
  }
111275
111302
  }
111276
- if (some(currentModuleInfo.exportedFunctions)) {
111277
- for (const f of currentModuleInfo.exportedFunctions) {
111278
- appendExportsOfHoistedDeclaration(statements, f);
111279
- }
111303
+ for (const f of currentModuleInfo.exportedFunctions) {
111304
+ appendExportsOfHoistedDeclaration(statements, f);
111280
111305
  }
111281
111306
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
111282
111307
  addRange(statements, visitNodes2(node.statements, topLevelVisitor, isStatement, statementOffset));
@@ -111593,10 +111618,8 @@ function transformModule(context) {
111593
111618
  if (some(currentModuleInfo.exportedNames)) {
111594
111619
  append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
111595
111620
  }
111596
- if (some(currentModuleInfo.exportedFunctions)) {
111597
- for (const f of currentModuleInfo.exportedFunctions) {
111598
- appendExportsOfHoistedDeclaration(statements, f);
111599
- }
111621
+ for (const f of currentModuleInfo.exportedFunctions) {
111622
+ appendExportsOfHoistedDeclaration(statements, f);
111600
111623
  }
111601
111624
  append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
111602
111625
  if (moduleKind === 2 /* AMD */) {
@@ -113310,7 +113333,7 @@ function transformSystemModule(context) {
113310
113333
  if (!moduleInfo.hasExportStarsToExportValues) {
113311
113334
  return;
113312
113335
  }
113313
- if (!some(moduleInfo.exportedNames) && !some(moduleInfo.exportedFunctions) && moduleInfo.exportSpecifiers.size === 0) {
113336
+ if (!some(moduleInfo.exportedNames) && moduleInfo.exportedFunctions.size === 0 && moduleInfo.exportSpecifiers.size === 0) {
113314
113337
  let hasExportDeclarationWithExportClause = false;
113315
113338
  for (const externalImport of moduleInfo.externalImports) {
113316
113339
  if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) {
@@ -113341,19 +113364,17 @@ function transformSystemModule(context) {
113341
113364
  );
113342
113365
  }
113343
113366
  }
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
- );
113367
+ for (const f of moduleInfo.exportedFunctions) {
113368
+ if (hasSyntacticModifier(f, 2048 /* Default */)) {
113369
+ continue;
113356
113370
  }
113371
+ Debug.assert(!!f.name);
113372
+ exportedNames.push(
113373
+ factory2.createPropertyAssignment(
113374
+ factory2.createStringLiteralFromNode(f.name),
113375
+ factory2.createTrue()
113376
+ )
113377
+ );
113357
113378
  }
113358
113379
  const exportedNamesStorageRef = factory2.createUniqueName("exportedNames");
113359
113380
  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-58703-2",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [