typescript 5.4.0-dev.20231212 → 5.4.0-dev.20231214

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/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.4";
38
- version = `${versionMajorMinor}.0-dev.20231212`;
38
+ version = `${versionMajorMinor}.0-dev.20231214`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8002,6 +8002,7 @@ ${lanes.join("\n")}
8002
8002
  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."),
8003
8003
  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."),
8004
8004
  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."),
8005
+ 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."),
8005
8006
  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}'."),
8006
8007
  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}'."),
8007
8008
  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}'."),
@@ -47820,6 +47821,7 @@ ${lanes.join("\n")}
47820
47821
  }
47821
47822
  if (nameNotFoundMessage) {
47822
47823
  addLazyDiagnostic(() => {
47824
+ var _a2;
47823
47825
  if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
47824
47826
  const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
47825
47827
  if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
@@ -47853,6 +47855,16 @@ ${lanes.join("\n")}
47853
47855
  );
47854
47856
  }
47855
47857
  }
47858
+ if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
47859
+ const isGlobal = lookup(globals, name, meaning) === result;
47860
+ const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
47861
+ if (nonValueSymbol) {
47862
+ 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 */);
47863
+ if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
47864
+ error2(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));
47865
+ }
47866
+ }
47867
+ }
47856
47868
  });
47857
47869
  }
47858
47870
  return result;
@@ -50182,12 +50194,16 @@ ${lanes.join("\n")}
50182
50194
  }
50183
50195
  function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
50184
50196
  let aliasesToMakeVisible;
50197
+ let bindingElementToMakeVisible;
50185
50198
  if (!every(filter(symbol.declarations, (d) => d.kind !== 80 /* Identifier */), getIsDeclarationVisible)) {
50186
50199
  return void 0;
50187
50200
  }
50188
- return { accessibility: 0 /* Accessible */, aliasesToMakeVisible };
50201
+ return { accessibility: 0 /* Accessible */, aliasesToMakeVisible, bindingElementToMakeVisible };
50189
50202
  function getIsDeclarationVisible(declaration) {
50190
50203
  var _a, _b;
50204
+ if (isBindingElement(declaration) && findAncestor(declaration, isParameter)) {
50205
+ bindingElementToMakeVisible = declaration;
50206
+ }
50191
50207
  if (!isDeclarationVisible(declaration)) {
50192
50208
  const anyImportSyntax = getAnyImportSyntax(declaration);
50193
50209
  if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
@@ -71435,7 +71451,7 @@ ${lanes.join("\n")}
71435
71451
  /*contextFlags*/
71436
71452
  void 0
71437
71453
  );
71438
- const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, isTupleLikeType);
71454
+ const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, (t) => isTupleLikeType(t) || isGenericMappedType(t) && !t.nameType && !!getHomomorphicTypeVariable(t.target || t));
71439
71455
  let hasOmittedExpression = false;
71440
71456
  for (let i = 0; i < elementCount; i++) {
71441
71457
  const e = elements[i];
@@ -110919,6 +110935,7 @@ ${lanes.join("\n")}
110919
110935
  let lateStatementReplacementMap;
110920
110936
  let suppressNewDiagnosticContexts;
110921
110937
  let exportedModulesFromDeclarationEmit;
110938
+ const usedBindingElementAliases = /* @__PURE__ */ new Map();
110922
110939
  const { factory: factory2 } = context;
110923
110940
  const host = context.getEmitHost();
110924
110941
  const symbolTracker = {
@@ -110975,7 +110992,7 @@ ${lanes.join("\n")}
110975
110992
  }
110976
110993
  function handleSymbolAccessibilityError(symbolAccessibilityResult) {
110977
110994
  if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
110978
- if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {
110995
+ if (symbolAccessibilityResult.aliasesToMakeVisible) {
110979
110996
  if (!lateMarkedStatements) {
110980
110997
  lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible;
110981
110998
  } else {
@@ -110984,6 +111001,17 @@ ${lanes.join("\n")}
110984
111001
  }
110985
111002
  }
110986
111003
  }
111004
+ if (symbolAccessibilityResult.bindingElementToMakeVisible) {
111005
+ const bindingElement = symbolAccessibilityResult.bindingElementToMakeVisible;
111006
+ const parameter = findAncestor(bindingElement, isParameter);
111007
+ Debug.assert(parameter !== void 0);
111008
+ const parent2 = getOriginalNode(parameter.parent);
111009
+ let aliases = usedBindingElementAliases.get(parent2);
111010
+ if (!aliases) {
111011
+ usedBindingElementAliases.set(parent2, aliases = /* @__PURE__ */ new Map());
111012
+ }
111013
+ aliases.set(getOriginalNode(bindingElement), bindingElement.name);
111014
+ }
110987
111015
  } else {
110988
111016
  const errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
110989
111017
  if (errorInfo) {
@@ -111333,7 +111361,7 @@ ${lanes.join("\n")}
111333
111361
  if (elem.propertyName && isComputedPropertyName(elem.propertyName) && isEntityNameExpression(elem.propertyName.expression)) {
111334
111362
  checkEntityNameVisibility(elem.propertyName.expression, enclosingDeclaration);
111335
111363
  }
111336
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
111364
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !isIdentifierANonContextualKeyword(elem.propertyName)) {
111337
111365
  return factory2.updateBindingElement(
111338
111366
  elem,
111339
111367
  elem.dotDotDotToken,
@@ -111352,6 +111380,161 @@ ${lanes.join("\n")}
111352
111380
  );
111353
111381
  }
111354
111382
  }
111383
+ function ensureBindingAliasesInParameterList(input, updatedNode) {
111384
+ const original = getOriginalNode(input);
111385
+ const params = updatedNode.parameters;
111386
+ const aliases = usedBindingElementAliases.get(original);
111387
+ if (!aliases) {
111388
+ return updatedNode;
111389
+ }
111390
+ usedBindingElementAliases.delete(original);
111391
+ const newParams = map(params, addUsedBindingPatternsToParameter);
111392
+ const newParamsNodeArray = factory2.createNodeArray(newParams, params.hasTrailingComma);
111393
+ switch (updatedNode.kind) {
111394
+ case 174 /* MethodDeclaration */:
111395
+ return factory2.updateMethodDeclaration(
111396
+ updatedNode,
111397
+ updatedNode.modifiers,
111398
+ updatedNode.asteriskToken,
111399
+ updatedNode.name,
111400
+ updatedNode.questionToken,
111401
+ updatedNode.typeParameters,
111402
+ newParamsNodeArray,
111403
+ updatedNode.type,
111404
+ updatedNode.body
111405
+ );
111406
+ case 176 /* Constructor */:
111407
+ return factory2.updateConstructorDeclaration(
111408
+ updatedNode,
111409
+ updatedNode.modifiers,
111410
+ newParamsNodeArray,
111411
+ updatedNode.body
111412
+ );
111413
+ case 177 /* GetAccessor */:
111414
+ return factory2.updateGetAccessorDeclaration(
111415
+ updatedNode,
111416
+ updatedNode.modifiers,
111417
+ updatedNode.name,
111418
+ newParamsNodeArray,
111419
+ updatedNode.type,
111420
+ updatedNode.body
111421
+ );
111422
+ case 178 /* SetAccessor */:
111423
+ return factory2.updateSetAccessorDeclaration(
111424
+ updatedNode,
111425
+ updatedNode.modifiers,
111426
+ updatedNode.name,
111427
+ newParamsNodeArray,
111428
+ updatedNode.body
111429
+ );
111430
+ case 219 /* ArrowFunction */:
111431
+ return factory2.updateArrowFunction(
111432
+ updatedNode,
111433
+ updatedNode.modifiers,
111434
+ updatedNode.typeParameters,
111435
+ newParamsNodeArray,
111436
+ updatedNode.type,
111437
+ updatedNode.equalsGreaterThanToken,
111438
+ updatedNode.body
111439
+ );
111440
+ case 262 /* FunctionDeclaration */:
111441
+ return factory2.updateFunctionDeclaration(
111442
+ updatedNode,
111443
+ updatedNode.modifiers,
111444
+ updatedNode.asteriskToken,
111445
+ updatedNode.name,
111446
+ updatedNode.typeParameters,
111447
+ newParamsNodeArray,
111448
+ updatedNode.type,
111449
+ updatedNode.body
111450
+ );
111451
+ case 179 /* CallSignature */:
111452
+ return factory2.updateCallSignature(
111453
+ updatedNode,
111454
+ updatedNode.typeParameters,
111455
+ newParamsNodeArray,
111456
+ updatedNode.type
111457
+ );
111458
+ case 173 /* MethodSignature */:
111459
+ return factory2.updateMethodSignature(
111460
+ updatedNode,
111461
+ updatedNode.modifiers,
111462
+ updatedNode.name,
111463
+ updatedNode.questionToken,
111464
+ updatedNode.typeParameters,
111465
+ newParamsNodeArray,
111466
+ updatedNode.type
111467
+ );
111468
+ case 180 /* ConstructSignature */:
111469
+ return factory2.updateConstructSignature(
111470
+ updatedNode,
111471
+ updatedNode.typeParameters,
111472
+ newParamsNodeArray,
111473
+ updatedNode.type
111474
+ );
111475
+ case 184 /* FunctionType */:
111476
+ return factory2.updateFunctionTypeNode(
111477
+ updatedNode,
111478
+ updatedNode.typeParameters,
111479
+ newParamsNodeArray,
111480
+ updatedNode.type
111481
+ );
111482
+ case 185 /* ConstructorType */:
111483
+ return factory2.updateConstructorTypeNode(
111484
+ updatedNode,
111485
+ updatedNode.modifiers,
111486
+ updatedNode.typeParameters,
111487
+ newParamsNodeArray,
111488
+ updatedNode.type
111489
+ );
111490
+ default:
111491
+ Debug.assertNever(updatedNode);
111492
+ }
111493
+ function addUsedBindingPatternsToParameter(p) {
111494
+ return factory2.updateParameterDeclaration(
111495
+ p,
111496
+ p.modifiers,
111497
+ p.dotDotDotToken,
111498
+ addUsedBindingPatternAliases(p.name),
111499
+ p.questionToken,
111500
+ p.type,
111501
+ p.initializer
111502
+ );
111503
+ }
111504
+ function addUsedBindingPatternAliases(name) {
111505
+ if (name.kind === 80 /* Identifier */) {
111506
+ return name;
111507
+ } else {
111508
+ if (name.kind === 207 /* ArrayBindingPattern */) {
111509
+ return factory2.updateArrayBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isArrayBindingElement));
111510
+ } else {
111511
+ return factory2.updateObjectBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isBindingElement));
111512
+ }
111513
+ }
111514
+ function visitBindingElement(elem) {
111515
+ if (elem.kind === 232 /* OmittedExpression */) {
111516
+ return elem;
111517
+ }
111518
+ const usedAlias = aliases.get(getOriginalNode(elem));
111519
+ if (usedAlias && !elem.propertyName) {
111520
+ return factory2.updateBindingElement(
111521
+ elem,
111522
+ elem.dotDotDotToken,
111523
+ elem.name,
111524
+ usedAlias,
111525
+ elem.initializer
111526
+ );
111527
+ }
111528
+ return factory2.updateBindingElement(
111529
+ elem,
111530
+ elem.dotDotDotToken,
111531
+ elem.propertyName,
111532
+ addUsedBindingPatternAliases(elem.name),
111533
+ elem.initializer
111534
+ );
111535
+ }
111536
+ }
111537
+ }
111355
111538
  function ensureParameter(p, modifierMask, type) {
111356
111539
  let oldDiag;
111357
111540
  if (!suppressNewDiagnosticContexts) {
@@ -111738,19 +111921,25 @@ ${lanes.join("\n")}
111738
111921
  return cleanup(factory2.updateTypeReferenceNode(node, node.typeName, node.typeArguments));
111739
111922
  }
111740
111923
  case 180 /* ConstructSignature */:
111741
- return cleanup(factory2.updateConstructSignature(
111924
+ return cleanup(ensureBindingAliasesInParameterList(
111742
111925
  input,
111743
- ensureTypeParams(input, input.typeParameters),
111744
- updateParamsList(input, input.parameters),
111745
- ensureType(input, input.type)
111926
+ factory2.updateConstructSignature(
111927
+ input,
111928
+ ensureTypeParams(input, input.typeParameters),
111929
+ updateParamsList(input, input.parameters),
111930
+ ensureType(input, input.type)
111931
+ )
111746
111932
  ));
111747
111933
  case 176 /* Constructor */: {
111748
- const ctor = factory2.createConstructorDeclaration(
111749
- /*modifiers*/
111750
- ensureModifiers(input),
111751
- updateParamsList(input, input.parameters, 0 /* None */),
111752
- /*body*/
111753
- void 0
111934
+ const ctor = ensureBindingAliasesInParameterList(
111935
+ input,
111936
+ factory2.createConstructorDeclaration(
111937
+ /*modifiers*/
111938
+ ensureModifiers(input),
111939
+ updateParamsList(input, input.parameters, 0 /* None */),
111940
+ /*body*/
111941
+ void 0
111942
+ )
111754
111943
  );
111755
111944
  return cleanup(ctor);
111756
111945
  }
@@ -111761,17 +111950,20 @@ ${lanes.join("\n")}
111761
111950
  void 0
111762
111951
  );
111763
111952
  }
111764
- const sig = factory2.createMethodDeclaration(
111765
- ensureModifiers(input),
111766
- /*asteriskToken*/
111767
- void 0,
111768
- input.name,
111769
- input.questionToken,
111770
- ensureTypeParams(input, input.typeParameters),
111771
- updateParamsList(input, input.parameters),
111772
- ensureType(input, input.type),
111773
- /*body*/
111774
- void 0
111953
+ const sig = ensureBindingAliasesInParameterList(
111954
+ input,
111955
+ factory2.createMethodDeclaration(
111956
+ ensureModifiers(input),
111957
+ /*asteriskToken*/
111958
+ void 0,
111959
+ input.name,
111960
+ input.questionToken,
111961
+ ensureTypeParams(input, input.typeParameters),
111962
+ updateParamsList(input, input.parameters),
111963
+ ensureType(input, input.type),
111964
+ /*body*/
111965
+ void 0
111966
+ )
111775
111967
  );
111776
111968
  return cleanup(sig);
111777
111969
  }
@@ -111783,14 +111975,17 @@ ${lanes.join("\n")}
111783
111975
  );
111784
111976
  }
111785
111977
  const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
111786
- return cleanup(factory2.updateGetAccessorDeclaration(
111978
+ return cleanup(ensureBindingAliasesInParameterList(
111787
111979
  input,
111788
- ensureModifiers(input),
111789
- input.name,
111790
- updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
111791
- ensureType(input, accessorType),
111792
- /*body*/
111793
- void 0
111980
+ factory2.updateGetAccessorDeclaration(
111981
+ input,
111982
+ ensureModifiers(input),
111983
+ input.name,
111984
+ updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
111985
+ ensureType(input, accessorType),
111986
+ /*body*/
111987
+ void 0
111988
+ )
111794
111989
  ));
111795
111990
  }
111796
111991
  case 178 /* SetAccessor */: {
@@ -111800,13 +111995,16 @@ ${lanes.join("\n")}
111800
111995
  void 0
111801
111996
  );
111802
111997
  }
111803
- return cleanup(factory2.updateSetAccessorDeclaration(
111998
+ return cleanup(ensureBindingAliasesInParameterList(
111804
111999
  input,
111805
- ensureModifiers(input),
111806
- input.name,
111807
- updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
111808
- /*body*/
111809
- void 0
112000
+ factory2.updateSetAccessorDeclaration(
112001
+ input,
112002
+ ensureModifiers(input),
112003
+ input.name,
112004
+ updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
112005
+ /*body*/
112006
+ void 0
112007
+ )
111810
112008
  ));
111811
112009
  }
111812
112010
  case 172 /* PropertyDeclaration */:
@@ -111845,22 +112043,28 @@ ${lanes.join("\n")}
111845
112043
  void 0
111846
112044
  );
111847
112045
  }
111848
- return cleanup(factory2.updateMethodSignature(
112046
+ return cleanup(ensureBindingAliasesInParameterList(
111849
112047
  input,
111850
- ensureModifiers(input),
111851
- input.name,
111852
- input.questionToken,
111853
- ensureTypeParams(input, input.typeParameters),
111854
- updateParamsList(input, input.parameters),
111855
- ensureType(input, input.type)
112048
+ factory2.updateMethodSignature(
112049
+ input,
112050
+ ensureModifiers(input),
112051
+ input.name,
112052
+ input.questionToken,
112053
+ ensureTypeParams(input, input.typeParameters),
112054
+ updateParamsList(input, input.parameters),
112055
+ ensureType(input, input.type)
112056
+ )
111856
112057
  ));
111857
112058
  }
111858
112059
  case 179 /* CallSignature */: {
111859
- return cleanup(factory2.updateCallSignature(
112060
+ return cleanup(ensureBindingAliasesInParameterList(
111860
112061
  input,
111861
- ensureTypeParams(input, input.typeParameters),
111862
- updateParamsList(input, input.parameters),
111863
- ensureType(input, input.type)
112062
+ factory2.updateCallSignature(
112063
+ input,
112064
+ ensureTypeParams(input, input.typeParameters),
112065
+ updateParamsList(input, input.parameters),
112066
+ ensureType(input, input.type)
112067
+ )
111864
112068
  ));
111865
112069
  }
111866
112070
  case 181 /* IndexSignature */: {
@@ -111915,10 +112119,27 @@ ${lanes.join("\n")}
111915
112119
  return cleanup(factory2.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
111916
112120
  }
111917
112121
  case 184 /* FunctionType */: {
111918
- return cleanup(factory2.updateFunctionTypeNode(input, visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))));
112122
+ return cleanup(ensureBindingAliasesInParameterList(
112123
+ input,
112124
+ factory2.updateFunctionTypeNode(
112125
+ input,
112126
+ visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
112127
+ updateParamsList(input, input.parameters),
112128
+ Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
112129
+ )
112130
+ ));
111919
112131
  }
111920
112132
  case 185 /* ConstructorType */: {
111921
- return cleanup(factory2.updateConstructorTypeNode(input, ensureModifiers(input), visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))));
112133
+ return cleanup(ensureBindingAliasesInParameterList(
112134
+ input,
112135
+ factory2.updateConstructorTypeNode(
112136
+ input,
112137
+ ensureModifiers(input),
112138
+ visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
112139
+ updateParamsList(input, input.parameters),
112140
+ Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
112141
+ )
112142
+ ));
111922
112143
  }
111923
112144
  case 205 /* ImportType */: {
111924
112145
  if (!isLiteralImportTypeNode(input))
@@ -112103,17 +112324,20 @@ ${lanes.join("\n")}
112103
112324
  ));
112104
112325
  }
112105
112326
  case 262 /* FunctionDeclaration */: {
112106
- const clean2 = cleanup(factory2.updateFunctionDeclaration(
112327
+ const clean2 = cleanup(ensureBindingAliasesInParameterList(
112107
112328
  input,
112108
- ensureModifiers(input),
112109
- /*asteriskToken*/
112110
- void 0,
112111
- input.name,
112112
- ensureTypeParams(input, input.typeParameters),
112113
- updateParamsList(input, input.parameters),
112114
- ensureType(input, input.type),
112115
- /*body*/
112116
- void 0
112329
+ factory2.updateFunctionDeclaration(
112330
+ input,
112331
+ ensureModifiers(input),
112332
+ /*asteriskToken*/
112333
+ void 0,
112334
+ input.name,
112335
+ ensureTypeParams(input, input.typeParameters),
112336
+ updateParamsList(input, input.parameters),
112337
+ ensureType(input, input.type),
112338
+ /*body*/
112339
+ void 0
112340
+ )
112117
112341
  ));
112118
112342
  if (clean2 && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) {
112119
112343
  const props = resolver.getPropertiesOfContainerFunction(input);
@@ -138481,7 +138705,7 @@ ${lanes.join("\n")}
138481
138705
  } else {
138482
138706
  const targetSourceFile = Debug.checkDefined(program.getSourceFile(targetFile));
138483
138707
  const importAdder = ts_codefix_exports.createImportAdder(targetSourceFile, context.program, context.preferences, context.host);
138484
- getNewStatementsAndRemoveFromOldFile2(oldFile, targetSourceFile, getUsageInfo(oldFile, toMove.all, checker, getExistingImports(targetSourceFile, checker)), changes, toMove, program, host, preferences, importAdder);
138708
+ getNewStatementsAndRemoveFromOldFile2(oldFile, targetSourceFile, getUsageInfo(oldFile, toMove.all, checker, getExistingLocals(targetSourceFile, toMove.all, checker)), changes, toMove, program, host, preferences, importAdder);
138485
138709
  }
138486
138710
  }
138487
138711
  function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences, importAdder) {
@@ -139147,7 +139371,7 @@ ${lanes.join("\n")}
139147
139371
  return false;
139148
139372
  }
139149
139373
  }
139150
- function getUsageInfo(oldFile, toMove, checker, existingTargetImports = /* @__PURE__ */ new Set()) {
139374
+ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PURE__ */ new Set()) {
139151
139375
  const movedSymbols = /* @__PURE__ */ new Set();
139152
139376
  const oldImportsNeededByTargetFile = /* @__PURE__ */ new Map();
139153
139377
  const targetFileImportsFromOldFile = /* @__PURE__ */ new Set();
@@ -139167,7 +139391,7 @@ ${lanes.join("\n")}
139167
139391
  if (!symbol.declarations) {
139168
139392
  return;
139169
139393
  }
139170
- if (existingTargetImports.has(skipAlias(symbol, checker))) {
139394
+ if (existingTargetLocals.has(skipAlias(symbol, checker))) {
139171
139395
  unusedImportsFromOldFile.add(symbol);
139172
139396
  return;
139173
139397
  }
@@ -139369,15 +139593,15 @@ ${lanes.join("\n")}
139369
139593
  }
139370
139594
  return void 0;
139371
139595
  }
139372
- function getExistingImports(sourceFile, checker) {
139373
- const imports = /* @__PURE__ */ new Set();
139596
+ function getExistingLocals(sourceFile, statements, checker) {
139597
+ const existingLocals = /* @__PURE__ */ new Set();
139374
139598
  for (const moduleSpecifier of sourceFile.imports) {
139375
139599
  const declaration = importFromModuleSpecifier(moduleSpecifier);
139376
139600
  if (isImportDeclaration(declaration) && declaration.importClause && declaration.importClause.namedBindings && isNamedImports(declaration.importClause.namedBindings)) {
139377
139601
  for (const e of declaration.importClause.namedBindings.elements) {
139378
139602
  const symbol = checker.getSymbolAtLocation(e.propertyName || e.name);
139379
139603
  if (symbol) {
139380
- imports.add(skipAlias(symbol, checker));
139604
+ existingLocals.add(skipAlias(symbol, checker));
139381
139605
  }
139382
139606
  }
139383
139607
  }
@@ -139385,12 +139609,20 @@ ${lanes.join("\n")}
139385
139609
  for (const e of declaration.parent.name.elements) {
139386
139610
  const symbol = checker.getSymbolAtLocation(e.propertyName || e.name);
139387
139611
  if (symbol) {
139388
- imports.add(skipAlias(symbol, checker));
139612
+ existingLocals.add(skipAlias(symbol, checker));
139389
139613
  }
139390
139614
  }
139391
139615
  }
139392
139616
  }
139393
- return imports;
139617
+ for (const statement of statements) {
139618
+ forEachReference(statement, checker, (s) => {
139619
+ const symbol = skipAlias(s, checker);
139620
+ if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration) === sourceFile) {
139621
+ existingLocals.add(symbol);
139622
+ }
139623
+ });
139624
+ }
139625
+ return existingLocals;
139394
139626
  }
139395
139627
  var refactorNameForMoveToFile, description2, moveToFileAction;
139396
139628
  var init_moveToFile = __esm({
@@ -165661,15 +165893,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
165661
165893
  }
165662
165894
  for (const tag of tags) {
165663
165895
  infos.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) });
165664
- if (isJSDocPropertyLikeTag(tag) && tag.isNameFirst && tag.typeExpression && isJSDocTypeLiteral(tag.typeExpression.type)) {
165665
- forEach(tag.typeExpression.type.jsDocPropertyTags, (propTag) => {
165666
- infos.push({ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) });
165667
- });
165668
- }
165896
+ infos.push(...getJSDocPropertyTagsInfo(tryGetJSDocPropertyTags(tag), checker));
165669
165897
  }
165670
165898
  });
165671
165899
  return infos;
165672
165900
  }
165901
+ function getJSDocPropertyTagsInfo(nodes, checker) {
165902
+ return flatMap(nodes, (propTag) => concatenate([{ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) }], getJSDocPropertyTagsInfo(tryGetJSDocPropertyTags(propTag), checker)));
165903
+ }
165904
+ function tryGetJSDocPropertyTags(node) {
165905
+ return isJSDocPropertyLikeTag(node) && node.isNameFirst && node.typeExpression && isJSDocTypeLiteral(node.typeExpression.type) ? node.typeExpression.type.jsDocPropertyTags : void 0;
165906
+ }
165673
165907
  function getDisplayPartsFromComment(comment, checker) {
165674
165908
  if (typeof comment === "string") {
165675
165909
  return [textPart(comment)];
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-dev.20231212`;
57
+ var version = `${versionMajorMinor}.0-dev.20231214`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -6049,6 +6049,7 @@ var Diagnostics = {
6049
6049
  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."),
6050
6050
  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."),
6051
6051
  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."),
6052
+ 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."),
6052
6053
  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}'."),
6053
6054
  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}'."),
6054
6055
  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}'."),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.4.0-dev.20231212",
5
+ "version": "5.4.0-dev.20231214",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "efc9c065a2caa52c5bebd08d730eed508075a78a"
116
+ "gitHead": "2c7162143bbbf567ccecc64105010699fa7a2128"
117
117
  }