@typescript-deploys/pr-build 5.4.0-pr-56742-5 → 5.4.0-pr-56794-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.
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-insiders.20231211`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231215`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6672,6 +6672,7 @@ var Diagnostics = {
6672
6672
  A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values: diag(2863, 1 /* Error */, "A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values_2863", "A class cannot extend a primitive type like '{0}'. Classes can only extend constructable values."),
6673
6673
  A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types: diag(2864, 1 /* Error */, "A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types_2864", "A class cannot implement a primitive type like '{0}'. It can only implement other named object types."),
6674
6674
  Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2865, 1 /* Error */, "Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_2865", "Import '{0}' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled."),
6675
+ Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2866, 1 /* Error */, "Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_w_2866", "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled."),
6675
6676
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6676
6677
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6677
6678
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -33289,6 +33290,12 @@ var Parser;
33289
33290
  if (isBracketed) {
33290
33291
  skipWhitespace();
33291
33292
  }
33293
+ const modifiers = parseModifiers(
33294
+ /*allowDecorators*/
33295
+ false,
33296
+ /*permitConstAsModifier*/
33297
+ true
33298
+ );
33292
33299
  const name = parseJSDocIdentifierName(Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
33293
33300
  let defaultType;
33294
33301
  if (isBracketed) {
@@ -33301,8 +33308,7 @@ var Parser;
33301
33308
  return void 0;
33302
33309
  }
33303
33310
  return finishNode(factory2.createTypeParameterDeclaration(
33304
- /*modifiers*/
33305
- void 0,
33311
+ modifiers,
33306
33312
  name,
33307
33313
  /*constraint*/
33308
33314
  void 0,
@@ -43384,7 +43390,8 @@ var intrinsicTypeKinds = new Map(Object.entries({
43384
43390
  Uppercase: 0 /* Uppercase */,
43385
43391
  Lowercase: 1 /* Lowercase */,
43386
43392
  Capitalize: 2 /* Capitalize */,
43387
- Uncapitalize: 3 /* Uncapitalize */
43393
+ Uncapitalize: 3 /* Uncapitalize */,
43394
+ NoInfer: 4 /* NoInfer */
43388
43395
  }));
43389
43396
  var SymbolLinks = class {
43390
43397
  };
@@ -45345,6 +45352,7 @@ function createTypeChecker(host) {
45345
45352
  }
45346
45353
  if (nameNotFoundMessage) {
45347
45354
  addLazyDiagnostic(() => {
45355
+ var _a2;
45348
45356
  if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
45349
45357
  const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
45350
45358
  if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
@@ -45378,6 +45386,16 @@ function createTypeChecker(host) {
45378
45386
  );
45379
45387
  }
45380
45388
  }
45389
+ if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
45390
+ const isGlobal = lookup(globals, name, meaning) === result;
45391
+ const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
45392
+ if (nonValueSymbol) {
45393
+ const importDecl = (_a2 = nonValueSymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 276 /* ImportSpecifier */ || d.kind === 273 /* ImportClause */ || d.kind === 274 /* NamespaceImport */ || d.kind === 271 /* ImportEqualsDeclaration */);
45394
+ if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
45395
+ error(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name));
45396
+ }
45397
+ }
45398
+ }
45381
45399
  });
45382
45400
  }
45383
45401
  return result;
@@ -47707,12 +47725,16 @@ function createTypeChecker(host) {
47707
47725
  }
47708
47726
  function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
47709
47727
  let aliasesToMakeVisible;
47728
+ let bindingElementToMakeVisible;
47710
47729
  if (!every(filter(symbol.declarations, (d) => d.kind !== 80 /* Identifier */), getIsDeclarationVisible)) {
47711
47730
  return void 0;
47712
47731
  }
47713
- return { accessibility: 0 /* Accessible */, aliasesToMakeVisible };
47732
+ return { accessibility: 0 /* Accessible */, aliasesToMakeVisible, bindingElementToMakeVisible };
47714
47733
  function getIsDeclarationVisible(declaration) {
47715
47734
  var _a, _b;
47735
+ if (isBindingElement(declaration) && findAncestor(declaration, isParameter)) {
47736
+ bindingElementToMakeVisible = declaration;
47737
+ }
47716
47738
  if (!isDeclarationVisible(declaration)) {
47717
47739
  const anyImportSyntax = getAnyImportSyntax(declaration);
47718
47740
  if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
@@ -48223,7 +48245,8 @@ function createTypeChecker(host) {
48223
48245
  return visitAndTransformType(type, (type2) => conditionalTypeToTypeNode(type2));
48224
48246
  }
48225
48247
  if (type.flags & 33554432 /* Substitution */) {
48226
- return typeToTypeNodeHelper(type.baseType, context);
48248
+ const typeNode = typeToTypeNodeHelper(type.baseType, context);
48249
+ return isNoInferType(type) ? factory.createTypeReferenceNode("NoInfer", [typeNode]) : typeNode;
48227
48250
  }
48228
48251
  return Debug.fail("Should be unreachable.");
48229
48252
  function conditionalTypeToTypeNode(type2) {
@@ -56127,8 +56150,11 @@ function createTypeChecker(host) {
56127
56150
  }
56128
56151
  function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
56129
56152
  const type = getDeclaredTypeOfSymbol(symbol);
56130
- if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
56131
- return getStringMappingType(symbol, typeArguments[0]);
56153
+ if (type === intrinsicMarkerType) {
56154
+ const typeKind = intrinsicTypeKinds.get(symbol.escapedName);
56155
+ if (typeKind !== void 0 && typeArguments && typeArguments.length === 1) {
56156
+ return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : getStringMappingType(symbol, typeArguments[0]);
56157
+ }
56132
56158
  }
56133
56159
  const links = getSymbolLinks(symbol);
56134
56160
  const typeParameters = links.typeParameters;
@@ -56282,10 +56308,19 @@ function createTypeChecker(host) {
56282
56308
  }
56283
56309
  return links.resolvedJSDocType;
56284
56310
  }
56311
+ function getNoInferType(type) {
56312
+ return isNoInferTargetType(type) ? getOrCreateSubstitutionType(type, unknownType) : type;
56313
+ }
56314
+ function isNoInferTargetType(type) {
56315
+ 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));
56316
+ }
56317
+ function isNoInferType(type) {
56318
+ return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
56319
+ }
56285
56320
  function getSubstitutionType(baseType, constraint) {
56286
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
56287
- return baseType;
56288
- }
56321
+ return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint);
56322
+ }
56323
+ function getOrCreateSubstitutionType(baseType, constraint) {
56289
56324
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
56290
56325
  const cached = substitutionTypes.get(id);
56291
56326
  if (cached) {
@@ -56298,7 +56333,7 @@ function createTypeChecker(host) {
56298
56333
  return result;
56299
56334
  }
56300
56335
  function getSubstitutionIntersection(substitutionType) {
56301
- return getIntersectionType([substitutionType.constraint, substitutionType.baseType]);
56336
+ return isNoInferType(substitutionType) ? substitutionType.baseType : getIntersectionType([substitutionType.constraint, substitutionType.baseType]);
56302
56337
  }
56303
56338
  function isUnaryTupleTypeNode(node) {
56304
56339
  return node.kind === 189 /* TupleType */ && node.elements.length === 1;
@@ -59556,6 +59591,9 @@ function createTypeChecker(host) {
59556
59591
  }
59557
59592
  if (flags & 33554432 /* Substitution */) {
59558
59593
  const newBaseType = instantiateType(type.baseType, mapper);
59594
+ if (isNoInferType(type)) {
59595
+ return getNoInferType(newBaseType);
59596
+ }
59559
59597
  const newConstraint = instantiateType(type.constraint, mapper);
59560
59598
  if (newBaseType.flags & 8650752 /* TypeVariable */ && isGenericType(newConstraint)) {
59561
59599
  return getSubstitutionType(newBaseType, newConstraint);
@@ -61689,18 +61727,6 @@ function createTypeChecker(host) {
61689
61727
  }
61690
61728
  return result2;
61691
61729
  }
61692
- function getApparentMappedTypeKeys(nameType, targetType) {
61693
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
61694
- const mappedKeys = [];
61695
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
61696
- modifiersType,
61697
- 8576 /* StringOrNumberLiteralOrUnique */,
61698
- /*stringsOnly*/
61699
- false,
61700
- (t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
61701
- );
61702
- return getUnionType(mappedKeys);
61703
- }
61704
61730
  function structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo) {
61705
61731
  let result2;
61706
61732
  let originalErrorInfo;
@@ -61883,8 +61909,16 @@ function createTypeChecker(host) {
61883
61909
  const constraintType = getConstraintTypeFromMappedType(targetType);
61884
61910
  let targetKeys;
61885
61911
  if (nameType && isMappedTypeWithKeyofConstraintDeclaration(targetType)) {
61886
- const mappedKeys = getApparentMappedTypeKeys(nameType, targetType);
61887
- targetKeys = getUnionType([mappedKeys, nameType]);
61912
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
61913
+ const mappedKeys = [];
61914
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
61915
+ modifiersType,
61916
+ 8576 /* StringOrNumberLiteralOrUnique */,
61917
+ /*stringsOnly*/
61918
+ false,
61919
+ (t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
61920
+ );
61921
+ targetKeys = getUnionType([...mappedKeys, nameType]);
61888
61922
  } else {
61889
61923
  targetKeys = nameType || constraintType;
61890
61924
  }
@@ -62055,18 +62089,9 @@ function createTypeChecker(host) {
62055
62089
  }
62056
62090
  }
62057
62091
  } else if (sourceFlags & 4194304 /* Index */) {
62058
- const isDeferredMappedIndex = shouldDeferIndexType(source2.type, source2.indexFlags) && getObjectFlags(source2.type) & 32 /* Mapped */;
62059
- if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
62092
+ if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2)) {
62060
62093
  return result2;
62061
62094
  }
62062
- if (isDeferredMappedIndex) {
62063
- const mappedType = source2.type;
62064
- const nameType = getNameTypeFromMappedType(mappedType);
62065
- const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
62066
- if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
62067
- return result2;
62068
- }
62069
- }
62070
62095
  } else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
62071
62096
  if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
62072
62097
  const constraint = getBaseConstraintOfType(source2);
@@ -64319,7 +64344,7 @@ function createTypeChecker(host) {
64319
64344
  let expandingFlags = 0 /* None */;
64320
64345
  inferFromTypes(originalSource, originalTarget);
64321
64346
  function inferFromTypes(source, target) {
64322
- if (!couldContainTypeVariables(target)) {
64347
+ if (!couldContainTypeVariables(target) || isNoInferType(target)) {
64323
64348
  return;
64324
64349
  }
64325
64350
  if (source === wildcardType || source === blockedStringType) {
@@ -64368,6 +64393,9 @@ function createTypeChecker(host) {
64368
64393
  }
64369
64394
  }
64370
64395
  if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
64396
+ if (isNoInferType(target)) {
64397
+ return;
64398
+ }
64371
64399
  target = getActualTypeVariable(target);
64372
64400
  }
64373
64401
  if (target.flags & 8650752 /* TypeVariable */) {
@@ -67098,6 +67126,16 @@ function createTypeChecker(host) {
67098
67126
  }
67099
67127
  return symbol.isAssigned || false;
67100
67128
  }
67129
+ function isSomeSymbolAssigned(rootDeclaration) {
67130
+ Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
67131
+ return isSomeSymbolAssignedWorker(rootDeclaration.name);
67132
+ }
67133
+ function isSomeSymbolAssignedWorker(node) {
67134
+ if (node.kind === 80 /* Identifier */) {
67135
+ return isSymbolAssigned(getSymbolOfDeclaration(node.parent));
67136
+ }
67137
+ return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
67138
+ }
67101
67139
  function hasParentWithAssignmentsMarked(node) {
67102
67140
  return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
67103
67141
  }
@@ -67211,7 +67249,7 @@ function createTypeChecker(host) {
67211
67249
  const parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
67212
67250
  const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
67213
67251
  links.flags &= ~4194304 /* InCheckIdentifier */;
67214
- if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) {
67252
+ if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ && isSomeSymbolAssigned(rootDeclaration))) {
67215
67253
  const pattern = declaration.parent;
67216
67254
  const narrowedType = getFlowTypeOfReference(
67217
67255
  pattern,
@@ -67240,7 +67278,7 @@ function createTypeChecker(host) {
67240
67278
  const contextualSignature = getContextualSignature(func);
67241
67279
  if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
67242
67280
  const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a = getInferenceContext(func)) == null ? void 0 : _a.nonFixingMapper));
67243
- if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
67281
+ if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) {
67244
67282
  const narrowedType = getFlowTypeOfReference(
67245
67283
  func,
67246
67284
  restType,
@@ -68963,7 +69001,7 @@ function createTypeChecker(host) {
68963
69001
  /*contextFlags*/
68964
69002
  void 0
68965
69003
  );
68966
- const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, isTupleLikeType);
69004
+ const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, (t) => isTupleLikeType(t) || isGenericMappedType(t) && !t.nameType && !!getHomomorphicTypeVariable(t.target || t));
68967
69005
  let hasOmittedExpression = false;
68968
69006
  for (let i = 0; i < elementCount; i++) {
68969
69007
  const e = elements[i];
@@ -81745,9 +81783,12 @@ function createTypeChecker(host) {
81745
81783
  case 1 /* ExportsProperty */:
81746
81784
  case 3 /* PrototypeProperty */:
81747
81785
  return getSymbolOfNode(entityName.parent);
81786
+ case 5 /* Property */:
81787
+ if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
81788
+ return void 0;
81789
+ }
81748
81790
  case 4 /* ThisProperty */:
81749
81791
  case 2 /* ModuleExports */:
81750
- case 5 /* Property */:
81751
81792
  return getSymbolOfDeclaration(entityName.parent.parent);
81752
81793
  }
81753
81794
  }
@@ -83351,6 +83392,7 @@ function createTypeChecker(host) {
83351
83392
  return externalHelpersModule;
83352
83393
  }
83353
83394
  function checkGrammarModifiers(node) {
83395
+ var _a;
83354
83396
  const quickResult = reportObviousDecoratorErrors(node) || reportObviousModifierErrors(node);
83355
83397
  if (quickResult !== void 0) {
83356
83398
  return quickResult;
@@ -83414,15 +83456,16 @@ function createTypeChecker(host) {
83414
83456
  }
83415
83457
  }
83416
83458
  switch (modifier.kind) {
83417
- case 87 /* ConstKeyword */:
83459
+ case 87 /* ConstKeyword */: {
83418
83460
  if (node.kind !== 266 /* EnumDeclaration */ && node.kind !== 168 /* TypeParameter */) {
83419
83461
  return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(87 /* ConstKeyword */));
83420
83462
  }
83421
- const parent = node.parent;
83463
+ const parent = isJSDocTemplateTag(node.parent) && getEffectiveJSDocHost(node.parent) || node.parent;
83422
83464
  if (node.kind === 168 /* TypeParameter */ && !(isFunctionLikeDeclaration(parent) || isClassLike(parent) || isFunctionTypeNode(parent) || isConstructorTypeNode(parent) || isCallSignatureDeclaration(parent) || isConstructSignatureDeclaration(parent) || isMethodSignature(parent))) {
83423
83465
  return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class, tokenToString(modifier.kind));
83424
83466
  }
83425
83467
  break;
83468
+ }
83426
83469
  case 164 /* OverrideKeyword */:
83427
83470
  if (flags & 16 /* Override */) {
83428
83471
  return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override");
@@ -83622,10 +83665,11 @@ function createTypeChecker(host) {
83622
83665
  lastAsync = modifier;
83623
83666
  break;
83624
83667
  case 103 /* InKeyword */:
83625
- case 147 /* OutKeyword */:
83668
+ case 147 /* OutKeyword */: {
83626
83669
  const inOutFlag = modifier.kind === 103 /* InKeyword */ ? 8192 /* In */ : 16384 /* Out */;
83627
83670
  const inOutText = modifier.kind === 103 /* InKeyword */ ? "in" : "out";
83628
- if (node.kind !== 168 /* TypeParameter */ || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) {
83671
+ const parent = isJSDocTemplateTag(node.parent) && (getEffectiveJSDocHost(node.parent) || find((_a = getJSDocRoot(node.parent)) == null ? void 0 : _a.tags, isJSDocTypedefTag)) || node.parent;
83672
+ if (node.kind !== 168 /* TypeParameter */ || parent && !(isInterfaceDeclaration(parent) || isClassLike(parent) || isTypeAliasDeclaration(parent) || isJSDocTypedefTag(parent))) {
83629
83673
  return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
83630
83674
  }
83631
83675
  if (flags & inOutFlag) {
@@ -83636,6 +83680,7 @@ function createTypeChecker(host) {
83636
83680
  }
83637
83681
  flags |= inOutFlag;
83638
83682
  break;
83683
+ }
83639
83684
  }
83640
83685
  }
83641
83686
  }
@@ -107964,6 +108009,7 @@ function transformDeclarations(context) {
107964
108009
  let lateStatementReplacementMap;
107965
108010
  let suppressNewDiagnosticContexts;
107966
108011
  let exportedModulesFromDeclarationEmit;
108012
+ const usedBindingElementAliases = /* @__PURE__ */ new Map();
107967
108013
  const { factory: factory2 } = context;
107968
108014
  const host = context.getEmitHost();
107969
108015
  const symbolTracker = {
@@ -108020,7 +108066,7 @@ function transformDeclarations(context) {
108020
108066
  }
108021
108067
  function handleSymbolAccessibilityError(symbolAccessibilityResult) {
108022
108068
  if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
108023
- if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {
108069
+ if (symbolAccessibilityResult.aliasesToMakeVisible) {
108024
108070
  if (!lateMarkedStatements) {
108025
108071
  lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible;
108026
108072
  } else {
@@ -108029,6 +108075,17 @@ function transformDeclarations(context) {
108029
108075
  }
108030
108076
  }
108031
108077
  }
108078
+ if (symbolAccessibilityResult.bindingElementToMakeVisible) {
108079
+ const bindingElement = symbolAccessibilityResult.bindingElementToMakeVisible;
108080
+ const parameter = findAncestor(bindingElement, isParameter);
108081
+ Debug.assert(parameter !== void 0);
108082
+ const parent = getOriginalNode(parameter.parent);
108083
+ let aliases = usedBindingElementAliases.get(parent);
108084
+ if (!aliases) {
108085
+ usedBindingElementAliases.set(parent, aliases = /* @__PURE__ */ new Map());
108086
+ }
108087
+ aliases.set(getOriginalNode(bindingElement), bindingElement.name);
108088
+ }
108032
108089
  } else {
108033
108090
  const errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
108034
108091
  if (errorInfo) {
@@ -108289,6 +108346,9 @@ function transformDeclarations(context) {
108289
108346
  }
108290
108347
  function mapReferencesIntoArray(references2, outputFilePath2) {
108291
108348
  return (file) => {
108349
+ if (exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.includes(file.symbol)) {
108350
+ return;
108351
+ }
108292
108352
  let declFileName;
108293
108353
  if (file.isDeclarationFile) {
108294
108354
  declFileName = file.fileName;
@@ -108375,7 +108435,7 @@ function transformDeclarations(context) {
108375
108435
  if (elem.propertyName && isComputedPropertyName(elem.propertyName) && isEntityNameExpression(elem.propertyName.expression)) {
108376
108436
  checkEntityNameVisibility(elem.propertyName.expression, enclosingDeclaration);
108377
108437
  }
108378
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
108438
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !isIdentifierANonContextualKeyword(elem.propertyName)) {
108379
108439
  return factory2.updateBindingElement(
108380
108440
  elem,
108381
108441
  elem.dotDotDotToken,
@@ -108394,6 +108454,161 @@ function transformDeclarations(context) {
108394
108454
  );
108395
108455
  }
108396
108456
  }
108457
+ function ensureBindingAliasesInParameterList(input, updatedNode) {
108458
+ const original = getOriginalNode(input);
108459
+ const params = updatedNode.parameters;
108460
+ const aliases = usedBindingElementAliases.get(original);
108461
+ if (!aliases) {
108462
+ return updatedNode;
108463
+ }
108464
+ usedBindingElementAliases.delete(original);
108465
+ const newParams = map(params, addUsedBindingPatternsToParameter);
108466
+ const newParamsNodeArray = factory2.createNodeArray(newParams, params.hasTrailingComma);
108467
+ switch (updatedNode.kind) {
108468
+ case 174 /* MethodDeclaration */:
108469
+ return factory2.updateMethodDeclaration(
108470
+ updatedNode,
108471
+ updatedNode.modifiers,
108472
+ updatedNode.asteriskToken,
108473
+ updatedNode.name,
108474
+ updatedNode.questionToken,
108475
+ updatedNode.typeParameters,
108476
+ newParamsNodeArray,
108477
+ updatedNode.type,
108478
+ updatedNode.body
108479
+ );
108480
+ case 176 /* Constructor */:
108481
+ return factory2.updateConstructorDeclaration(
108482
+ updatedNode,
108483
+ updatedNode.modifiers,
108484
+ newParamsNodeArray,
108485
+ updatedNode.body
108486
+ );
108487
+ case 177 /* GetAccessor */:
108488
+ return factory2.updateGetAccessorDeclaration(
108489
+ updatedNode,
108490
+ updatedNode.modifiers,
108491
+ updatedNode.name,
108492
+ newParamsNodeArray,
108493
+ updatedNode.type,
108494
+ updatedNode.body
108495
+ );
108496
+ case 178 /* SetAccessor */:
108497
+ return factory2.updateSetAccessorDeclaration(
108498
+ updatedNode,
108499
+ updatedNode.modifiers,
108500
+ updatedNode.name,
108501
+ newParamsNodeArray,
108502
+ updatedNode.body
108503
+ );
108504
+ case 219 /* ArrowFunction */:
108505
+ return factory2.updateArrowFunction(
108506
+ updatedNode,
108507
+ updatedNode.modifiers,
108508
+ updatedNode.typeParameters,
108509
+ newParamsNodeArray,
108510
+ updatedNode.type,
108511
+ updatedNode.equalsGreaterThanToken,
108512
+ updatedNode.body
108513
+ );
108514
+ case 262 /* FunctionDeclaration */:
108515
+ return factory2.updateFunctionDeclaration(
108516
+ updatedNode,
108517
+ updatedNode.modifiers,
108518
+ updatedNode.asteriskToken,
108519
+ updatedNode.name,
108520
+ updatedNode.typeParameters,
108521
+ newParamsNodeArray,
108522
+ updatedNode.type,
108523
+ updatedNode.body
108524
+ );
108525
+ case 179 /* CallSignature */:
108526
+ return factory2.updateCallSignature(
108527
+ updatedNode,
108528
+ updatedNode.typeParameters,
108529
+ newParamsNodeArray,
108530
+ updatedNode.type
108531
+ );
108532
+ case 173 /* MethodSignature */:
108533
+ return factory2.updateMethodSignature(
108534
+ updatedNode,
108535
+ updatedNode.modifiers,
108536
+ updatedNode.name,
108537
+ updatedNode.questionToken,
108538
+ updatedNode.typeParameters,
108539
+ newParamsNodeArray,
108540
+ updatedNode.type
108541
+ );
108542
+ case 180 /* ConstructSignature */:
108543
+ return factory2.updateConstructSignature(
108544
+ updatedNode,
108545
+ updatedNode.typeParameters,
108546
+ newParamsNodeArray,
108547
+ updatedNode.type
108548
+ );
108549
+ case 184 /* FunctionType */:
108550
+ return factory2.updateFunctionTypeNode(
108551
+ updatedNode,
108552
+ updatedNode.typeParameters,
108553
+ newParamsNodeArray,
108554
+ updatedNode.type
108555
+ );
108556
+ case 185 /* ConstructorType */:
108557
+ return factory2.updateConstructorTypeNode(
108558
+ updatedNode,
108559
+ updatedNode.modifiers,
108560
+ updatedNode.typeParameters,
108561
+ newParamsNodeArray,
108562
+ updatedNode.type
108563
+ );
108564
+ default:
108565
+ Debug.assertNever(updatedNode);
108566
+ }
108567
+ function addUsedBindingPatternsToParameter(p) {
108568
+ return factory2.updateParameterDeclaration(
108569
+ p,
108570
+ p.modifiers,
108571
+ p.dotDotDotToken,
108572
+ addUsedBindingPatternAliases(p.name),
108573
+ p.questionToken,
108574
+ p.type,
108575
+ p.initializer
108576
+ );
108577
+ }
108578
+ function addUsedBindingPatternAliases(name) {
108579
+ if (name.kind === 80 /* Identifier */) {
108580
+ return name;
108581
+ } else {
108582
+ if (name.kind === 207 /* ArrayBindingPattern */) {
108583
+ return factory2.updateArrayBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isArrayBindingElement));
108584
+ } else {
108585
+ return factory2.updateObjectBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isBindingElement));
108586
+ }
108587
+ }
108588
+ function visitBindingElement(elem) {
108589
+ if (elem.kind === 232 /* OmittedExpression */) {
108590
+ return elem;
108591
+ }
108592
+ const usedAlias = aliases.get(getOriginalNode(elem));
108593
+ if (usedAlias && !elem.propertyName) {
108594
+ return factory2.updateBindingElement(
108595
+ elem,
108596
+ elem.dotDotDotToken,
108597
+ elem.name,
108598
+ usedAlias,
108599
+ elem.initializer
108600
+ );
108601
+ }
108602
+ return factory2.updateBindingElement(
108603
+ elem,
108604
+ elem.dotDotDotToken,
108605
+ elem.propertyName,
108606
+ addUsedBindingPatternAliases(elem.name),
108607
+ elem.initializer
108608
+ );
108609
+ }
108610
+ }
108611
+ }
108397
108612
  function ensureParameter(p, modifierMask, type) {
108398
108613
  let oldDiag;
108399
108614
  if (!suppressNewDiagnosticContexts) {
@@ -108780,19 +108995,25 @@ function transformDeclarations(context) {
108780
108995
  return cleanup(factory2.updateTypeReferenceNode(node, node.typeName, node.typeArguments));
108781
108996
  }
108782
108997
  case 180 /* ConstructSignature */:
108783
- return cleanup(factory2.updateConstructSignature(
108998
+ return cleanup(ensureBindingAliasesInParameterList(
108784
108999
  input,
108785
- ensureTypeParams(input, input.typeParameters),
108786
- updateParamsList(input, input.parameters),
108787
- ensureType(input, input.type)
109000
+ factory2.updateConstructSignature(
109001
+ input,
109002
+ ensureTypeParams(input, input.typeParameters),
109003
+ updateParamsList(input, input.parameters),
109004
+ ensureType(input, input.type)
109005
+ )
108788
109006
  ));
108789
109007
  case 176 /* Constructor */: {
108790
- const ctor = factory2.createConstructorDeclaration(
108791
- /*modifiers*/
108792
- ensureModifiers(input),
108793
- updateParamsList(input, input.parameters, 0 /* None */),
108794
- /*body*/
108795
- void 0
109008
+ const ctor = ensureBindingAliasesInParameterList(
109009
+ input,
109010
+ factory2.createConstructorDeclaration(
109011
+ /*modifiers*/
109012
+ ensureModifiers(input),
109013
+ updateParamsList(input, input.parameters, 0 /* None */),
109014
+ /*body*/
109015
+ void 0
109016
+ )
108796
109017
  );
108797
109018
  return cleanup(ctor);
108798
109019
  }
@@ -108803,17 +109024,20 @@ function transformDeclarations(context) {
108803
109024
  void 0
108804
109025
  );
108805
109026
  }
108806
- const sig = factory2.createMethodDeclaration(
108807
- ensureModifiers(input),
108808
- /*asteriskToken*/
108809
- void 0,
108810
- input.name,
108811
- input.questionToken,
108812
- ensureTypeParams(input, input.typeParameters),
108813
- updateParamsList(input, input.parameters),
108814
- ensureType(input, input.type),
108815
- /*body*/
108816
- void 0
109027
+ const sig = ensureBindingAliasesInParameterList(
109028
+ input,
109029
+ factory2.createMethodDeclaration(
109030
+ ensureModifiers(input),
109031
+ /*asteriskToken*/
109032
+ void 0,
109033
+ input.name,
109034
+ input.questionToken,
109035
+ ensureTypeParams(input, input.typeParameters),
109036
+ updateParamsList(input, input.parameters),
109037
+ ensureType(input, input.type),
109038
+ /*body*/
109039
+ void 0
109040
+ )
108817
109041
  );
108818
109042
  return cleanup(sig);
108819
109043
  }
@@ -108825,14 +109049,17 @@ function transformDeclarations(context) {
108825
109049
  );
108826
109050
  }
108827
109051
  const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
108828
- return cleanup(factory2.updateGetAccessorDeclaration(
109052
+ return cleanup(ensureBindingAliasesInParameterList(
108829
109053
  input,
108830
- ensureModifiers(input),
108831
- input.name,
108832
- updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
108833
- ensureType(input, accessorType),
108834
- /*body*/
108835
- void 0
109054
+ factory2.updateGetAccessorDeclaration(
109055
+ input,
109056
+ ensureModifiers(input),
109057
+ input.name,
109058
+ updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
109059
+ ensureType(input, accessorType),
109060
+ /*body*/
109061
+ void 0
109062
+ )
108836
109063
  ));
108837
109064
  }
108838
109065
  case 178 /* SetAccessor */: {
@@ -108842,13 +109069,16 @@ function transformDeclarations(context) {
108842
109069
  void 0
108843
109070
  );
108844
109071
  }
108845
- return cleanup(factory2.updateSetAccessorDeclaration(
109072
+ return cleanup(ensureBindingAliasesInParameterList(
108846
109073
  input,
108847
- ensureModifiers(input),
108848
- input.name,
108849
- updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
108850
- /*body*/
108851
- void 0
109074
+ factory2.updateSetAccessorDeclaration(
109075
+ input,
109076
+ ensureModifiers(input),
109077
+ input.name,
109078
+ updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
109079
+ /*body*/
109080
+ void 0
109081
+ )
108852
109082
  ));
108853
109083
  }
108854
109084
  case 172 /* PropertyDeclaration */:
@@ -108887,22 +109117,28 @@ function transformDeclarations(context) {
108887
109117
  void 0
108888
109118
  );
108889
109119
  }
108890
- return cleanup(factory2.updateMethodSignature(
109120
+ return cleanup(ensureBindingAliasesInParameterList(
108891
109121
  input,
108892
- ensureModifiers(input),
108893
- input.name,
108894
- input.questionToken,
108895
- ensureTypeParams(input, input.typeParameters),
108896
- updateParamsList(input, input.parameters),
108897
- ensureType(input, input.type)
109122
+ factory2.updateMethodSignature(
109123
+ input,
109124
+ ensureModifiers(input),
109125
+ input.name,
109126
+ input.questionToken,
109127
+ ensureTypeParams(input, input.typeParameters),
109128
+ updateParamsList(input, input.parameters),
109129
+ ensureType(input, input.type)
109130
+ )
108898
109131
  ));
108899
109132
  }
108900
109133
  case 179 /* CallSignature */: {
108901
- return cleanup(factory2.updateCallSignature(
109134
+ return cleanup(ensureBindingAliasesInParameterList(
108902
109135
  input,
108903
- ensureTypeParams(input, input.typeParameters),
108904
- updateParamsList(input, input.parameters),
108905
- ensureType(input, input.type)
109136
+ factory2.updateCallSignature(
109137
+ input,
109138
+ ensureTypeParams(input, input.typeParameters),
109139
+ updateParamsList(input, input.parameters),
109140
+ ensureType(input, input.type)
109141
+ )
108906
109142
  ));
108907
109143
  }
108908
109144
  case 181 /* IndexSignature */: {
@@ -108957,10 +109193,27 @@ function transformDeclarations(context) {
108957
109193
  return cleanup(factory2.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
108958
109194
  }
108959
109195
  case 184 /* FunctionType */: {
108960
- return cleanup(factory2.updateFunctionTypeNode(input, visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))));
109196
+ return cleanup(ensureBindingAliasesInParameterList(
109197
+ input,
109198
+ factory2.updateFunctionTypeNode(
109199
+ input,
109200
+ visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
109201
+ updateParamsList(input, input.parameters),
109202
+ Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
109203
+ )
109204
+ ));
108961
109205
  }
108962
109206
  case 185 /* ConstructorType */: {
108963
- return cleanup(factory2.updateConstructorTypeNode(input, ensureModifiers(input), visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))));
109207
+ return cleanup(ensureBindingAliasesInParameterList(
109208
+ input,
109209
+ factory2.updateConstructorTypeNode(
109210
+ input,
109211
+ ensureModifiers(input),
109212
+ visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
109213
+ updateParamsList(input, input.parameters),
109214
+ Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
109215
+ )
109216
+ ));
108964
109217
  }
108965
109218
  case 205 /* ImportType */: {
108966
109219
  if (!isLiteralImportTypeNode(input))
@@ -109145,17 +109398,20 @@ function transformDeclarations(context) {
109145
109398
  ));
109146
109399
  }
109147
109400
  case 262 /* FunctionDeclaration */: {
109148
- const clean2 = cleanup(factory2.updateFunctionDeclaration(
109401
+ const clean2 = cleanup(ensureBindingAliasesInParameterList(
109149
109402
  input,
109150
- ensureModifiers(input),
109151
- /*asteriskToken*/
109152
- void 0,
109153
- input.name,
109154
- ensureTypeParams(input, input.typeParameters),
109155
- updateParamsList(input, input.parameters),
109156
- ensureType(input, input.type),
109157
- /*body*/
109158
- void 0
109403
+ factory2.updateFunctionDeclaration(
109404
+ input,
109405
+ ensureModifiers(input),
109406
+ /*asteriskToken*/
109407
+ void 0,
109408
+ input.name,
109409
+ ensureTypeParams(input, input.typeParameters),
109410
+ updateParamsList(input, input.parameters),
109411
+ ensureType(input, input.type),
109412
+ /*body*/
109413
+ void 0
109414
+ )
109159
109415
  ));
109160
109416
  if (clean2 && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) {
109161
109417
  const props = resolver.getPropertiesOfContainerFunction(input);