typescript 5.4.0-dev.20240111 → 5.4.0-dev.20240113

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.4";
21
- var version = `${versionMajorMinor}.0-dev.20240111`;
21
+ var version = `${versionMajorMinor}.0-dev.20240113`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -4898,6 +4898,7 @@ var sys = (() => {
4898
4898
  resolvePath: (path) => _path.resolve(path),
4899
4899
  fileExists,
4900
4900
  directoryExists,
4901
+ getAccessibleFileSystemEntries,
4901
4902
  createDirectory(directoryName) {
4902
4903
  if (!nodeSystem.directoryExists(directoryName)) {
4903
4904
  try {
@@ -11372,6 +11373,45 @@ function isRestParameter(node) {
11372
11373
  const type = isJSDocParameterTag(node) ? node.typeExpression && node.typeExpression.type : node.type;
11373
11374
  return node.dotDotDotToken !== void 0 || !!type && type.kind === 325 /* JSDocVariadicType */;
11374
11375
  }
11376
+ function hasInternalAnnotation(range, sourceFile) {
11377
+ const comment = sourceFile.text.substring(range.pos, range.end);
11378
+ return comment.includes("@internal");
11379
+ }
11380
+ function isInternalDeclaration(node, sourceFile) {
11381
+ sourceFile ?? (sourceFile = getSourceFileOfNode(node));
11382
+ const parseTreeNode = getParseTreeNode(node);
11383
+ if (parseTreeNode && parseTreeNode.kind === 169 /* Parameter */) {
11384
+ const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
11385
+ const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0;
11386
+ const text = sourceFile.text;
11387
+ const commentRanges = previousSibling ? concatenate(
11388
+ // to handle
11389
+ // ... parameters, /** @internal */
11390
+ // public param: string
11391
+ getTrailingCommentRanges(text, skipTrivia(
11392
+ text,
11393
+ previousSibling.end + 1,
11394
+ /*stopAfterLineBreak*/
11395
+ false,
11396
+ /*stopAtComments*/
11397
+ true
11398
+ )),
11399
+ getLeadingCommentRanges(text, node.pos)
11400
+ ) : getTrailingCommentRanges(text, skipTrivia(
11401
+ text,
11402
+ node.pos,
11403
+ /*stopAfterLineBreak*/
11404
+ false,
11405
+ /*stopAtComments*/
11406
+ true
11407
+ ));
11408
+ return some(commentRanges) && hasInternalAnnotation(last(commentRanges), sourceFile);
11409
+ }
11410
+ const leadingCommentRanges = parseTreeNode && getLeadingCommentRangesOfNode(parseTreeNode, sourceFile);
11411
+ return !!forEach(leadingCommentRanges, (range) => {
11412
+ return hasInternalAnnotation(range, sourceFile);
11413
+ });
11414
+ }
11375
11415
 
11376
11416
  // src/compiler/utilities.ts
11377
11417
  var resolvingEmptyArray = [];
@@ -34068,7 +34108,7 @@ var libEntries = [
34068
34108
  ["es2023.array", "lib.es2023.array.d.ts"],
34069
34109
  ["es2023.collection", "lib.es2023.collection.d.ts"],
34070
34110
  ["esnext.array", "lib.es2023.array.d.ts"],
34071
- ["esnext.collection", "lib.es2023.collection.d.ts"],
34111
+ ["esnext.collection", "lib.esnext.collection.d.ts"],
34072
34112
  ["esnext.symbol", "lib.es2019.symbol.d.ts"],
34073
34113
  ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
34074
34114
  ["esnext.intl", "lib.esnext.intl.d.ts"],
@@ -34078,6 +34118,7 @@ var libEntries = [
34078
34118
  ["esnext.promise", "lib.esnext.promise.d.ts"],
34079
34119
  ["esnext.weakref", "lib.es2021.weakref.d.ts"],
34080
34120
  ["esnext.decorators", "lib.esnext.decorators.d.ts"],
34121
+ ["esnext.object", "lib.esnext.object.d.ts"],
34081
34122
  ["decorators", "lib.decorators.d.ts"],
34082
34123
  ["decorators.legacy", "lib.decorators.legacy.d.ts"]
34083
34124
  ];
@@ -43521,7 +43562,8 @@ var intrinsicTypeKinds = new Map(Object.entries({
43521
43562
  Uppercase: 0 /* Uppercase */,
43522
43563
  Lowercase: 1 /* Lowercase */,
43523
43564
  Capitalize: 2 /* Capitalize */,
43524
- Uncapitalize: 3 /* Uncapitalize */
43565
+ Uncapitalize: 3 /* Uncapitalize */,
43566
+ NoInfer: 4 /* NoInfer */
43525
43567
  }));
43526
43568
  var SymbolLinks = class {
43527
43569
  };
@@ -44606,7 +44648,12 @@ function createTypeChecker(host) {
44606
44648
  }
44607
44649
  function markAsSynthetic(node) {
44608
44650
  setTextRangePosEnd(node, -1, -1);
44609
- return visitEachChild(node, markAsSynthetic, nullTransformationContext);
44651
+ return visitEachChild(
44652
+ node,
44653
+ markAsSynthetic,
44654
+ /*context*/
44655
+ void 0
44656
+ );
44610
44657
  }
44611
44658
  function getEmitResolver(sourceFile, cancellationToken2) {
44612
44659
  getDiagnostics(sourceFile, cancellationToken2);
@@ -47882,16 +47929,12 @@ function createTypeChecker(host) {
47882
47929
  }
47883
47930
  function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
47884
47931
  let aliasesToMakeVisible;
47885
- let bindingElementToMakeVisible;
47886
47932
  if (!every(filter(symbol.declarations, (d) => d.kind !== 80 /* Identifier */), getIsDeclarationVisible)) {
47887
47933
  return void 0;
47888
47934
  }
47889
- return { accessibility: 0 /* Accessible */, aliasesToMakeVisible, bindingElementToMakeVisible };
47935
+ return { accessibility: 0 /* Accessible */, aliasesToMakeVisible };
47890
47936
  function getIsDeclarationVisible(declaration) {
47891
47937
  var _a, _b;
47892
- if (isBindingElement(declaration) && findAncestor(declaration, isParameter)) {
47893
- bindingElementToMakeVisible = declaration;
47894
- }
47895
47938
  if (!isDeclarationVisible(declaration)) {
47896
47939
  const anyImportSyntax = getAnyImportSyntax(declaration);
47897
47940
  if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
@@ -48402,7 +48445,13 @@ function createTypeChecker(host) {
48402
48445
  return visitAndTransformType(type, (type2) => conditionalTypeToTypeNode(type2));
48403
48446
  }
48404
48447
  if (type.flags & 33554432 /* Substitution */) {
48405
- return typeToTypeNodeHelper(type.baseType, context);
48448
+ const typeNode = typeToTypeNodeHelper(type.baseType, context);
48449
+ const noInferSymbol = isNoInferType(type) && getGlobalTypeSymbol(
48450
+ "NoInfer",
48451
+ /*reportErrors*/
48452
+ false
48453
+ );
48454
+ return noInferSymbol ? symbolToTypeNode(noInferSymbol, context, 788968 /* Type */, [typeNode]) : typeNode;
48406
48455
  }
48407
48456
  return Debug.fail("Should be unreachable.");
48408
48457
  function conditionalTypeToTypeNode(type2) {
@@ -48648,7 +48697,13 @@ function createTypeChecker(host) {
48648
48697
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
48649
48698
  return node;
48650
48699
  }
48651
- return setTextRange(factory.cloneNode(visitEachChild(node, deepCloneOrReuseNode, nullTransformationContext, deepCloneOrReuseNodes)), node);
48700
+ return setTextRange(factory.cloneNode(visitEachChild(
48701
+ node,
48702
+ deepCloneOrReuseNode,
48703
+ /*context*/
48704
+ void 0,
48705
+ deepCloneOrReuseNodes
48706
+ )), node);
48652
48707
  }
48653
48708
  function deepCloneOrReuseNodes(nodes, visitor, test, start, count) {
48654
48709
  if (nodes && nodes.length === 0) {
@@ -49370,7 +49425,8 @@ function createTypeChecker(host) {
49370
49425
  let visited = visitEachChild(
49371
49426
  node2,
49372
49427
  elideInitializerAndSetEmitFlags,
49373
- nullTransformationContext,
49428
+ /*context*/
49429
+ void 0,
49374
49430
  /*nodesVisitor*/
49375
49431
  void 0,
49376
49432
  elideInitializerAndSetEmitFlags
@@ -50148,7 +50204,12 @@ function createTypeChecker(host) {
50148
50204
  if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
50149
50205
  setEmitFlags(node, 1 /* SingleLine */);
50150
50206
  }
50151
- return visitEachChild(node, visitExistingNodeTreeSymbols, nullTransformationContext);
50207
+ return visitEachChild(
50208
+ node,
50209
+ visitExistingNodeTreeSymbols,
50210
+ /*context*/
50211
+ void 0
50212
+ );
50152
50213
  function getEffectiveDotDotDotForParameter(p) {
50153
50214
  return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? factory.createToken(26 /* DotDotDotToken */) : void 0);
50154
50215
  }
@@ -50248,7 +50309,7 @@ function createTypeChecker(host) {
50248
50309
  });
50249
50310
  let addingDeclare = !bundled;
50250
50311
  const exportEquals = symbolTable.get("export=" /* ExportEquals */);
50251
- if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* Alias */) {
50312
+ if (exportEquals && symbolTable.size > 1 && exportEquals.flags & (2097152 /* Alias */ | 1536 /* Module */)) {
50252
50313
  symbolTable = createSymbolTable();
50253
50314
  symbolTable.set("export=" /* ExportEquals */, exportEquals);
50254
50315
  }
@@ -50705,8 +50766,18 @@ function createTypeChecker(host) {
50705
50766
  );
50706
50767
  }
50707
50768
  function getNamespaceMembersForSerialization(symbol) {
50708
- const exports2 = getExportsOfSymbol(symbol);
50709
- return !exports2 ? [] : filter(arrayFrom(exports2.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
50769
+ let exports2 = arrayFrom(getExportsOfSymbol(symbol).values());
50770
+ const merged = getMergedSymbol(symbol);
50771
+ if (merged !== symbol) {
50772
+ const membersSet = new Set(exports2);
50773
+ for (const exported of getExportsOfSymbol(merged).values()) {
50774
+ if (!(getSymbolFlags(resolveSymbol(exported)) & 111551 /* Value */)) {
50775
+ membersSet.add(exported);
50776
+ }
50777
+ }
50778
+ exports2 = arrayFrom(membersSet);
50779
+ }
50780
+ return filter(exports2, (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
50710
50781
  }
50711
50782
  function isTypeOnlyNamespace(symbol) {
50712
50783
  return every(getNamespaceMembersForSerialization(symbol), (m) => !(getSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
@@ -56350,8 +56421,11 @@ function createTypeChecker(host) {
56350
56421
  }
56351
56422
  function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
56352
56423
  const type = getDeclaredTypeOfSymbol(symbol);
56353
- if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
56354
- return getStringMappingType(symbol, typeArguments[0]);
56424
+ if (type === intrinsicMarkerType) {
56425
+ const typeKind = intrinsicTypeKinds.get(symbol.escapedName);
56426
+ if (typeKind !== void 0 && typeArguments && typeArguments.length === 1) {
56427
+ return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : getStringMappingType(symbol, typeArguments[0]);
56428
+ }
56355
56429
  }
56356
56430
  const links = getSymbolLinks(symbol);
56357
56431
  const typeParameters = links.typeParameters;
@@ -56505,10 +56579,19 @@ function createTypeChecker(host) {
56505
56579
  }
56506
56580
  return links.resolvedJSDocType;
56507
56581
  }
56582
+ function getNoInferType(type) {
56583
+ return isNoInferTargetType(type) ? getOrCreateSubstitutionType(type, unknownType) : type;
56584
+ }
56585
+ function isNoInferTargetType(type) {
56586
+ return !!(type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, isNoInferTargetType) || type.flags & 33554432 /* Substitution */ && !isNoInferType(type) && isNoInferTargetType(type.baseType) || type.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(type) || type.flags & (465829888 /* Instantiable */ & ~33554432 /* Substitution */) && !isPatternLiteralType(type));
56587
+ }
56588
+ function isNoInferType(type) {
56589
+ return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
56590
+ }
56508
56591
  function getSubstitutionType(baseType, constraint) {
56509
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
56510
- return baseType;
56511
- }
56592
+ return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint);
56593
+ }
56594
+ function getOrCreateSubstitutionType(baseType, constraint) {
56512
56595
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
56513
56596
  const cached = substitutionTypes.get(id);
56514
56597
  if (cached) {
@@ -56521,7 +56604,7 @@ function createTypeChecker(host) {
56521
56604
  return result;
56522
56605
  }
56523
56606
  function getSubstitutionIntersection(substitutionType) {
56524
- return getIntersectionType([substitutionType.constraint, substitutionType.baseType]);
56607
+ return isNoInferType(substitutionType) ? substitutionType.baseType : getIntersectionType([substitutionType.constraint, substitutionType.baseType]);
56525
56608
  }
56526
56609
  function isUnaryTupleTypeNode(node) {
56527
56610
  return node.kind === 189 /* TupleType */ && node.elements.length === 1;
@@ -58050,7 +58133,7 @@ function createTypeChecker(host) {
58050
58133
  }
58051
58134
  function getIndexType(type, indexFlags = defaultIndexFlags) {
58052
58135
  type = getReducedType(type);
58053
- return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), indexFlags === defaultIndexFlags);
58136
+ return isNoInferType(type) ? getNoInferType(getIndexType(type.baseType, indexFlags)) : shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), indexFlags === defaultIndexFlags);
58054
58137
  }
58055
58138
  function getExtractStringType(type) {
58056
58139
  if (keyofStringsOnly) {
@@ -59793,6 +59876,9 @@ function createTypeChecker(host) {
59793
59876
  }
59794
59877
  if (flags & 33554432 /* Substitution */) {
59795
59878
  const newBaseType = instantiateType(type.baseType, mapper);
59879
+ if (isNoInferType(type)) {
59880
+ return getNoInferType(newBaseType);
59881
+ }
59796
59882
  const newConstraint = instantiateType(type.constraint, mapper);
59797
59883
  if (newBaseType.flags & 8650752 /* TypeVariable */ && isGenericType(newConstraint)) {
59798
59884
  return getSubstitutionType(newBaseType, newConstraint);
@@ -64585,7 +64671,7 @@ function createTypeChecker(host) {
64585
64671
  let expandingFlags = 0 /* None */;
64586
64672
  inferFromTypes(originalSource, originalTarget);
64587
64673
  function inferFromTypes(source, target) {
64588
- if (!couldContainTypeVariables(target)) {
64674
+ if (!couldContainTypeVariables(target) || isNoInferType(target)) {
64589
64675
  return;
64590
64676
  }
64591
64677
  if (source === wildcardType || source === blockedStringType) {
@@ -64634,6 +64720,9 @@ function createTypeChecker(host) {
64634
64720
  }
64635
64721
  }
64636
64722
  if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
64723
+ if (isNoInferType(target)) {
64724
+ return;
64725
+ }
64637
64726
  target = getActualTypeVariable(target);
64638
64727
  }
64639
64728
  if (target.flags & 8650752 /* TypeVariable */) {
@@ -85645,7 +85734,7 @@ function visitCommaListElements(elements, visitor, discardVisitor = visitor) {
85645
85734
  return discarded ? discardVisitor(node) : visitor(node);
85646
85735
  }, isExpression);
85647
85736
  }
85648
- function visitEachChild(node, visitor, context, nodesVisitor = visitNodes2, tokenVisitor, nodeVisitor = visitNode) {
85737
+ function visitEachChild(node, visitor, context = nullTransformationContext, nodesVisitor = visitNodes2, tokenVisitor, nodeVisitor = visitNode) {
85649
85738
  if (node === void 0) {
85650
85739
  return void 0;
85651
85740
  }
@@ -99948,12 +100037,22 @@ function transformES2015(context) {
99948
100037
  case 172 /* PropertyDeclaration */: {
99949
100038
  const named = node;
99950
100039
  if (isComputedPropertyName(named.name)) {
99951
- return factory2.replacePropertyName(named, visitEachChild(named.name, elideUnusedThisCaptureWorker, nullTransformationContext));
100040
+ return factory2.replacePropertyName(named, visitEachChild(
100041
+ named.name,
100042
+ elideUnusedThisCaptureWorker,
100043
+ /*context*/
100044
+ void 0
100045
+ ));
99952
100046
  }
99953
100047
  return node;
99954
100048
  }
99955
100049
  }
99956
- return visitEachChild(node, elideUnusedThisCaptureWorker, nullTransformationContext);
100050
+ return visitEachChild(
100051
+ node,
100052
+ elideUnusedThisCaptureWorker,
100053
+ /*context*/
100054
+ void 0
100055
+ );
99957
100056
  }
99958
100057
  function simplifyConstructorElideUnusedThisCapture(body, original) {
99959
100058
  if (original.transformFlags & 16384 /* ContainsLexicalThis */ || hierarchyFacts & 65536 /* LexicalThis */ || hierarchyFacts & 131072 /* CapturedLexicalThis */) {
@@ -99989,12 +100088,22 @@ function transformES2015(context) {
99989
100088
  case 172 /* PropertyDeclaration */: {
99990
100089
  const named = node;
99991
100090
  if (isComputedPropertyName(named.name)) {
99992
- return factory2.replacePropertyName(named, visitEachChild(named.name, injectSuperPresenceCheckWorker, nullTransformationContext));
100091
+ return factory2.replacePropertyName(named, visitEachChild(
100092
+ named.name,
100093
+ injectSuperPresenceCheckWorker,
100094
+ /*context*/
100095
+ void 0
100096
+ ));
99993
100097
  }
99994
100098
  return node;
99995
100099
  }
99996
100100
  }
99997
- return visitEachChild(node, injectSuperPresenceCheckWorker, nullTransformationContext);
100101
+ return visitEachChild(
100102
+ node,
100103
+ injectSuperPresenceCheckWorker,
100104
+ /*context*/
100105
+ void 0
100106
+ );
99998
100107
  }
99999
100108
  function complicateConstructorInjectSuperPresenceCheck(body) {
100000
100109
  return factory2.updateBlock(body, visitNodes2(body.statements, injectSuperPresenceCheckWorker, isStatement));
@@ -108392,44 +108501,6 @@ function getDeclarationDiagnostics(host, resolver, file) {
108392
108501
  );
108393
108502
  return result.diagnostics;
108394
108503
  }
108395
- function hasInternalAnnotation(range, currentSourceFile) {
108396
- const comment = currentSourceFile.text.substring(range.pos, range.end);
108397
- return comment.includes("@internal");
108398
- }
108399
- function isInternalDeclaration(node, currentSourceFile) {
108400
- const parseTreeNode = getParseTreeNode(node);
108401
- if (parseTreeNode && parseTreeNode.kind === 169 /* Parameter */) {
108402
- const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
108403
- const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0;
108404
- const text = currentSourceFile.text;
108405
- const commentRanges = previousSibling ? concatenate(
108406
- // to handle
108407
- // ... parameters, /** @internal */
108408
- // public param: string
108409
- getTrailingCommentRanges(text, skipTrivia(
108410
- text,
108411
- previousSibling.end + 1,
108412
- /*stopAfterLineBreak*/
108413
- false,
108414
- /*stopAtComments*/
108415
- true
108416
- )),
108417
- getLeadingCommentRanges(text, node.pos)
108418
- ) : getTrailingCommentRanges(text, skipTrivia(
108419
- text,
108420
- node.pos,
108421
- /*stopAfterLineBreak*/
108422
- false,
108423
- /*stopAtComments*/
108424
- true
108425
- ));
108426
- return commentRanges && commentRanges.length && hasInternalAnnotation(last(commentRanges), currentSourceFile);
108427
- }
108428
- const leadingCommentRanges = parseTreeNode && getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
108429
- return !!forEach(leadingCommentRanges, (range) => {
108430
- return hasInternalAnnotation(range, currentSourceFile);
108431
- });
108432
- }
108433
108504
  var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
108434
108505
  function transformDeclarations(context) {
108435
108506
  const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
@@ -108445,7 +108516,6 @@ function transformDeclarations(context) {
108445
108516
  let lateStatementReplacementMap;
108446
108517
  let suppressNewDiagnosticContexts;
108447
108518
  let exportedModulesFromDeclarationEmit;
108448
- const usedBindingElementAliases = /* @__PURE__ */ new Map();
108449
108519
  const { factory: factory2 } = context;
108450
108520
  const host = context.getEmitHost();
108451
108521
  const symbolTracker = {
@@ -108511,17 +108581,6 @@ function transformDeclarations(context) {
108511
108581
  }
108512
108582
  }
108513
108583
  }
108514
- if (symbolAccessibilityResult.bindingElementToMakeVisible) {
108515
- const bindingElement = symbolAccessibilityResult.bindingElementToMakeVisible;
108516
- const parameter = findAncestor(bindingElement, isParameter);
108517
- Debug.assert(parameter !== void 0);
108518
- const parent = getOriginalNode(parameter.parent);
108519
- let aliases = usedBindingElementAliases.get(parent);
108520
- if (!aliases) {
108521
- usedBindingElementAliases.set(parent, aliases = /* @__PURE__ */ new Map());
108522
- }
108523
- aliases.set(getOriginalNode(bindingElement), bindingElement.name);
108524
- }
108525
108584
  } else {
108526
108585
  const errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
108527
108586
  if (errorInfo) {
@@ -108854,7 +108913,7 @@ function transformDeclarations(context) {
108854
108913
  });
108855
108914
  return ret;
108856
108915
  }
108857
- function filterBindingPatternInitializersAndRenamings(name) {
108916
+ function filterBindingPatternInitializers(name) {
108858
108917
  if (name.kind === 80 /* Identifier */) {
108859
108918
  return name;
108860
108919
  } else {
@@ -108871,180 +108930,15 @@ function transformDeclarations(context) {
108871
108930
  if (elem.propertyName && isComputedPropertyName(elem.propertyName) && isEntityNameExpression(elem.propertyName.expression)) {
108872
108931
  checkEntityNameVisibility(elem.propertyName.expression, enclosingDeclaration);
108873
108932
  }
108874
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !isIdentifierANonContextualKeyword(elem.propertyName)) {
108875
- return factory2.updateBindingElement(
108876
- elem,
108877
- elem.dotDotDotToken,
108878
- /*propertyName*/
108879
- void 0,
108880
- elem.propertyName,
108881
- shouldPrintWithInitializer(elem) ? elem.initializer : void 0
108882
- );
108883
- }
108884
108933
  return factory2.updateBindingElement(
108885
108934
  elem,
108886
108935
  elem.dotDotDotToken,
108887
108936
  elem.propertyName,
108888
- filterBindingPatternInitializersAndRenamings(elem.name),
108937
+ filterBindingPatternInitializers(elem.name),
108889
108938
  shouldPrintWithInitializer(elem) ? elem.initializer : void 0
108890
108939
  );
108891
108940
  }
108892
108941
  }
108893
- function ensureBindingAliasesInParameterList(input, updatedNode) {
108894
- const original = getOriginalNode(input);
108895
- const params = updatedNode.parameters;
108896
- const aliases = usedBindingElementAliases.get(original);
108897
- if (!aliases) {
108898
- return updatedNode;
108899
- }
108900
- usedBindingElementAliases.delete(original);
108901
- const newParams = map(params, addUsedBindingPatternsToParameter);
108902
- const newParamsNodeArray = factory2.createNodeArray(newParams, params.hasTrailingComma);
108903
- switch (updatedNode.kind) {
108904
- case 174 /* MethodDeclaration */:
108905
- return factory2.updateMethodDeclaration(
108906
- updatedNode,
108907
- updatedNode.modifiers,
108908
- updatedNode.asteriskToken,
108909
- updatedNode.name,
108910
- updatedNode.questionToken,
108911
- updatedNode.typeParameters,
108912
- newParamsNodeArray,
108913
- updatedNode.type,
108914
- updatedNode.body
108915
- );
108916
- case 176 /* Constructor */:
108917
- return factory2.updateConstructorDeclaration(
108918
- updatedNode,
108919
- updatedNode.modifiers,
108920
- newParamsNodeArray,
108921
- updatedNode.body
108922
- );
108923
- case 177 /* GetAccessor */:
108924
- return factory2.updateGetAccessorDeclaration(
108925
- updatedNode,
108926
- updatedNode.modifiers,
108927
- updatedNode.name,
108928
- newParamsNodeArray,
108929
- updatedNode.type,
108930
- updatedNode.body
108931
- );
108932
- case 178 /* SetAccessor */:
108933
- return factory2.updateSetAccessorDeclaration(
108934
- updatedNode,
108935
- updatedNode.modifiers,
108936
- updatedNode.name,
108937
- newParamsNodeArray,
108938
- updatedNode.body
108939
- );
108940
- case 219 /* ArrowFunction */:
108941
- return factory2.updateArrowFunction(
108942
- updatedNode,
108943
- updatedNode.modifiers,
108944
- updatedNode.typeParameters,
108945
- newParamsNodeArray,
108946
- updatedNode.type,
108947
- updatedNode.equalsGreaterThanToken,
108948
- updatedNode.body
108949
- );
108950
- case 262 /* FunctionDeclaration */:
108951
- return factory2.updateFunctionDeclaration(
108952
- updatedNode,
108953
- updatedNode.modifiers,
108954
- updatedNode.asteriskToken,
108955
- updatedNode.name,
108956
- updatedNode.typeParameters,
108957
- newParamsNodeArray,
108958
- updatedNode.type,
108959
- updatedNode.body
108960
- );
108961
- case 179 /* CallSignature */:
108962
- return factory2.updateCallSignature(
108963
- updatedNode,
108964
- updatedNode.typeParameters,
108965
- newParamsNodeArray,
108966
- updatedNode.type
108967
- );
108968
- case 173 /* MethodSignature */:
108969
- return factory2.updateMethodSignature(
108970
- updatedNode,
108971
- updatedNode.modifiers,
108972
- updatedNode.name,
108973
- updatedNode.questionToken,
108974
- updatedNode.typeParameters,
108975
- newParamsNodeArray,
108976
- updatedNode.type
108977
- );
108978
- case 180 /* ConstructSignature */:
108979
- return factory2.updateConstructSignature(
108980
- updatedNode,
108981
- updatedNode.typeParameters,
108982
- newParamsNodeArray,
108983
- updatedNode.type
108984
- );
108985
- case 184 /* FunctionType */:
108986
- return factory2.updateFunctionTypeNode(
108987
- updatedNode,
108988
- updatedNode.typeParameters,
108989
- newParamsNodeArray,
108990
- updatedNode.type
108991
- );
108992
- case 185 /* ConstructorType */:
108993
- return factory2.updateConstructorTypeNode(
108994
- updatedNode,
108995
- updatedNode.modifiers,
108996
- updatedNode.typeParameters,
108997
- newParamsNodeArray,
108998
- updatedNode.type
108999
- );
109000
- default:
109001
- Debug.assertNever(updatedNode);
109002
- }
109003
- function addUsedBindingPatternsToParameter(p) {
109004
- return factory2.updateParameterDeclaration(
109005
- p,
109006
- p.modifiers,
109007
- p.dotDotDotToken,
109008
- addUsedBindingPatternAliases(p.name),
109009
- p.questionToken,
109010
- p.type,
109011
- p.initializer
109012
- );
109013
- }
109014
- function addUsedBindingPatternAliases(name) {
109015
- if (name.kind === 80 /* Identifier */) {
109016
- return name;
109017
- } else {
109018
- if (name.kind === 207 /* ArrayBindingPattern */) {
109019
- return factory2.updateArrayBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isArrayBindingElement));
109020
- } else {
109021
- return factory2.updateObjectBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isBindingElement));
109022
- }
109023
- }
109024
- function visitBindingElement(elem) {
109025
- if (elem.kind === 232 /* OmittedExpression */) {
109026
- return elem;
109027
- }
109028
- const usedAlias = aliases.get(getOriginalNode(elem));
109029
- if (usedAlias && !elem.propertyName) {
109030
- return factory2.updateBindingElement(
109031
- elem,
109032
- elem.dotDotDotToken,
109033
- elem.name,
109034
- usedAlias,
109035
- elem.initializer
109036
- );
109037
- }
109038
- return factory2.updateBindingElement(
109039
- elem,
109040
- elem.dotDotDotToken,
109041
- elem.propertyName,
109042
- addUsedBindingPatternAliases(elem.name),
109043
- elem.initializer
109044
- );
109045
- }
109046
- }
109047
- }
109048
108942
  function ensureParameter(p, modifierMask, type) {
109049
108943
  let oldDiag;
109050
108944
  if (!suppressNewDiagnosticContexts) {
@@ -109055,7 +108949,7 @@ function transformDeclarations(context) {
109055
108949
  p,
109056
108950
  maskModifiers(factory2, p, modifierMask),
109057
108951
  p.dotDotDotToken,
109058
- filterBindingPatternInitializersAndRenamings(p.name),
108952
+ filterBindingPatternInitializers(p.name),
109059
108953
  resolver.isOptionalParameter(p) ? p.questionToken || factory2.createToken(58 /* QuestionToken */) : void 0,
109060
108954
  ensureType(
109061
108955
  p,
@@ -109431,25 +109325,19 @@ function transformDeclarations(context) {
109431
109325
  return cleanup(factory2.updateTypeReferenceNode(node, node.typeName, node.typeArguments));
109432
109326
  }
109433
109327
  case 180 /* ConstructSignature */:
109434
- return cleanup(ensureBindingAliasesInParameterList(
109328
+ return cleanup(factory2.updateConstructSignature(
109435
109329
  input,
109436
- factory2.updateConstructSignature(
109437
- input,
109438
- ensureTypeParams(input, input.typeParameters),
109439
- updateParamsList(input, input.parameters),
109440
- ensureType(input, input.type)
109441
- )
109330
+ ensureTypeParams(input, input.typeParameters),
109331
+ updateParamsList(input, input.parameters),
109332
+ ensureType(input, input.type)
109442
109333
  ));
109443
109334
  case 176 /* Constructor */: {
109444
- const ctor = ensureBindingAliasesInParameterList(
109445
- input,
109446
- factory2.createConstructorDeclaration(
109447
- /*modifiers*/
109448
- ensureModifiers(input),
109449
- updateParamsList(input, input.parameters, 0 /* None */),
109450
- /*body*/
109451
- void 0
109452
- )
109335
+ const ctor = factory2.createConstructorDeclaration(
109336
+ /*modifiers*/
109337
+ ensureModifiers(input),
109338
+ updateParamsList(input, input.parameters, 0 /* None */),
109339
+ /*body*/
109340
+ void 0
109453
109341
  );
109454
109342
  return cleanup(ctor);
109455
109343
  }
@@ -109460,20 +109348,17 @@ function transformDeclarations(context) {
109460
109348
  void 0
109461
109349
  );
109462
109350
  }
109463
- const sig = ensureBindingAliasesInParameterList(
109464
- input,
109465
- factory2.createMethodDeclaration(
109466
- ensureModifiers(input),
109467
- /*asteriskToken*/
109468
- void 0,
109469
- input.name,
109470
- input.questionToken,
109471
- ensureTypeParams(input, input.typeParameters),
109472
- updateParamsList(input, input.parameters),
109473
- ensureType(input, input.type),
109474
- /*body*/
109475
- void 0
109476
- )
109351
+ const sig = factory2.createMethodDeclaration(
109352
+ ensureModifiers(input),
109353
+ /*asteriskToken*/
109354
+ void 0,
109355
+ input.name,
109356
+ input.questionToken,
109357
+ ensureTypeParams(input, input.typeParameters),
109358
+ updateParamsList(input, input.parameters),
109359
+ ensureType(input, input.type),
109360
+ /*body*/
109361
+ void 0
109477
109362
  );
109478
109363
  return cleanup(sig);
109479
109364
  }
@@ -109485,17 +109370,14 @@ function transformDeclarations(context) {
109485
109370
  );
109486
109371
  }
109487
109372
  const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
109488
- return cleanup(ensureBindingAliasesInParameterList(
109373
+ return cleanup(factory2.updateGetAccessorDeclaration(
109489
109374
  input,
109490
- factory2.updateGetAccessorDeclaration(
109491
- input,
109492
- ensureModifiers(input),
109493
- input.name,
109494
- updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
109495
- ensureType(input, accessorType),
109496
- /*body*/
109497
- void 0
109498
- )
109375
+ ensureModifiers(input),
109376
+ input.name,
109377
+ updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
109378
+ ensureType(input, accessorType),
109379
+ /*body*/
109380
+ void 0
109499
109381
  ));
109500
109382
  }
109501
109383
  case 178 /* SetAccessor */: {
@@ -109505,16 +109387,13 @@ function transformDeclarations(context) {
109505
109387
  void 0
109506
109388
  );
109507
109389
  }
109508
- return cleanup(ensureBindingAliasesInParameterList(
109390
+ return cleanup(factory2.updateSetAccessorDeclaration(
109509
109391
  input,
109510
- factory2.updateSetAccessorDeclaration(
109511
- input,
109512
- ensureModifiers(input),
109513
- input.name,
109514
- updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
109515
- /*body*/
109516
- void 0
109517
- )
109392
+ ensureModifiers(input),
109393
+ input.name,
109394
+ updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
109395
+ /*body*/
109396
+ void 0
109518
109397
  ));
109519
109398
  }
109520
109399
  case 172 /* PropertyDeclaration */:
@@ -109553,29 +109432,25 @@ function transformDeclarations(context) {
109553
109432
  void 0
109554
109433
  );
109555
109434
  }
109556
- return cleanup(ensureBindingAliasesInParameterList(
109435
+ return cleanup(factory2.updateMethodSignature(
109557
109436
  input,
109558
- factory2.updateMethodSignature(
109559
- input,
109560
- ensureModifiers(input),
109561
- input.name,
109562
- input.questionToken,
109563
- ensureTypeParams(input, input.typeParameters),
109564
- updateParamsList(input, input.parameters),
109565
- ensureType(input, input.type)
109566
- )
109437
+ ensureModifiers(input),
109438
+ input.name,
109439
+ input.questionToken,
109440
+ ensureTypeParams(input, input.typeParameters),
109441
+ updateParamsList(input, input.parameters),
109442
+ ensureType(input, input.type)
109567
109443
  ));
109568
109444
  }
109569
109445
  case 179 /* CallSignature */: {
109570
- return cleanup(ensureBindingAliasesInParameterList(
109571
- input,
109446
+ return cleanup(
109572
109447
  factory2.updateCallSignature(
109573
109448
  input,
109574
109449
  ensureTypeParams(input, input.typeParameters),
109575
109450
  updateParamsList(input, input.parameters),
109576
109451
  ensureType(input, input.type)
109577
109452
  )
109578
- ));
109453
+ );
109579
109454
  }
109580
109455
  case 181 /* IndexSignature */: {
109581
109456
  return cleanup(factory2.updateIndexSignature(
@@ -109629,26 +109504,20 @@ function transformDeclarations(context) {
109629
109504
  return cleanup(factory2.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
109630
109505
  }
109631
109506
  case 184 /* FunctionType */: {
109632
- return cleanup(ensureBindingAliasesInParameterList(
109507
+ return cleanup(factory2.updateFunctionTypeNode(
109633
109508
  input,
109634
- factory2.updateFunctionTypeNode(
109635
- input,
109636
- visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
109637
- updateParamsList(input, input.parameters),
109638
- Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
109639
- )
109509
+ visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
109510
+ updateParamsList(input, input.parameters),
109511
+ Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
109640
109512
  ));
109641
109513
  }
109642
109514
  case 185 /* ConstructorType */: {
109643
- return cleanup(ensureBindingAliasesInParameterList(
109515
+ return cleanup(factory2.updateConstructorTypeNode(
109644
109516
  input,
109645
- factory2.updateConstructorTypeNode(
109646
- input,
109647
- ensureModifiers(input),
109648
- visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
109649
- updateParamsList(input, input.parameters),
109650
- Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
109651
- )
109517
+ ensureModifiers(input),
109518
+ visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
109519
+ updateParamsList(input, input.parameters),
109520
+ Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
109652
109521
  ));
109653
109522
  }
109654
109523
  case 205 /* ImportType */: {
@@ -109834,20 +109703,17 @@ function transformDeclarations(context) {
109834
109703
  ));
109835
109704
  }
109836
109705
  case 262 /* FunctionDeclaration */: {
109837
- const clean2 = cleanup(ensureBindingAliasesInParameterList(
109706
+ const clean2 = cleanup(factory2.updateFunctionDeclaration(
109838
109707
  input,
109839
- factory2.updateFunctionDeclaration(
109840
- input,
109841
- ensureModifiers(input),
109842
- /*asteriskToken*/
109843
- void 0,
109844
- input.name,
109845
- ensureTypeParams(input, input.typeParameters),
109846
- updateParamsList(input, input.parameters),
109847
- ensureType(input, input.type),
109848
- /*body*/
109849
- void 0
109850
- )
109708
+ ensureModifiers(input),
109709
+ /*asteriskToken*/
109710
+ void 0,
109711
+ input.name,
109712
+ ensureTypeParams(input, input.typeParameters),
109713
+ updateParamsList(input, input.parameters),
109714
+ ensureType(input, input.type),
109715
+ /*body*/
109716
+ void 0
109851
109717
  ));
109852
109718
  if (clean2 && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) {
109853
109719
  const props = resolver.getPropertiesOfContainerFunction(input);