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/lib.es2016.intl.d.ts +1 -1
- package/lib/lib.es2018.intl.d.ts +3 -3
- package/lib/tsc.js +286 -62
- package/lib/tsserver.js +309 -75
- package/lib/typescript.js +309 -75
- package/lib/typingsInstaller.js +2 -1
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -2335,7 +2335,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2335
2335
|
|
|
2336
2336
|
// src/compiler/corePublic.ts
|
|
2337
2337
|
var versionMajorMinor = "5.4";
|
|
2338
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2338
|
+
var version = `${versionMajorMinor}.0-dev.20231214`;
|
|
2339
2339
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2340
2340
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2341
2341
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10227,6 +10227,7 @@ var Diagnostics = {
|
|
|
10227
10227
|
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."),
|
|
10228
10228
|
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."),
|
|
10229
10229
|
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."),
|
|
10230
|
+
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."),
|
|
10230
10231
|
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}'."),
|
|
10231
10232
|
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}'."),
|
|
10232
10233
|
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}'."),
|
|
@@ -50060,6 +50061,7 @@ function createTypeChecker(host) {
|
|
|
50060
50061
|
}
|
|
50061
50062
|
if (nameNotFoundMessage) {
|
|
50062
50063
|
addLazyDiagnostic(() => {
|
|
50064
|
+
var _a2;
|
|
50063
50065
|
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
50064
50066
|
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
50065
50067
|
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
@@ -50093,6 +50095,16 @@ function createTypeChecker(host) {
|
|
|
50093
50095
|
);
|
|
50094
50096
|
}
|
|
50095
50097
|
}
|
|
50098
|
+
if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
50099
|
+
const isGlobal = lookup(globals, name, meaning) === result;
|
|
50100
|
+
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
|
|
50101
|
+
if (nonValueSymbol) {
|
|
50102
|
+
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 */);
|
|
50103
|
+
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
50104
|
+
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));
|
|
50105
|
+
}
|
|
50106
|
+
}
|
|
50107
|
+
}
|
|
50096
50108
|
});
|
|
50097
50109
|
}
|
|
50098
50110
|
return result;
|
|
@@ -52422,12 +52434,16 @@ function createTypeChecker(host) {
|
|
|
52422
52434
|
}
|
|
52423
52435
|
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
|
|
52424
52436
|
let aliasesToMakeVisible;
|
|
52437
|
+
let bindingElementToMakeVisible;
|
|
52425
52438
|
if (!every(filter(symbol.declarations, (d) => d.kind !== 80 /* Identifier */), getIsDeclarationVisible)) {
|
|
52426
52439
|
return void 0;
|
|
52427
52440
|
}
|
|
52428
|
-
return { accessibility: 0 /* Accessible */, aliasesToMakeVisible };
|
|
52441
|
+
return { accessibility: 0 /* Accessible */, aliasesToMakeVisible, bindingElementToMakeVisible };
|
|
52429
52442
|
function getIsDeclarationVisible(declaration) {
|
|
52430
52443
|
var _a, _b;
|
|
52444
|
+
if (isBindingElement(declaration) && findAncestor(declaration, isParameter)) {
|
|
52445
|
+
bindingElementToMakeVisible = declaration;
|
|
52446
|
+
}
|
|
52431
52447
|
if (!isDeclarationVisible(declaration)) {
|
|
52432
52448
|
const anyImportSyntax = getAnyImportSyntax(declaration);
|
|
52433
52449
|
if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
|
|
@@ -73675,7 +73691,7 @@ function createTypeChecker(host) {
|
|
|
73675
73691
|
/*contextFlags*/
|
|
73676
73692
|
void 0
|
|
73677
73693
|
);
|
|
73678
|
-
const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, isTupleLikeType);
|
|
73694
|
+
const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, (t) => isTupleLikeType(t) || isGenericMappedType(t) && !t.nameType && !!getHomomorphicTypeVariable(t.target || t));
|
|
73679
73695
|
let hasOmittedExpression = false;
|
|
73680
73696
|
for (let i = 0; i < elementCount; i++) {
|
|
73681
73697
|
const e = elements[i];
|
|
@@ -112850,6 +112866,7 @@ function transformDeclarations(context) {
|
|
|
112850
112866
|
let lateStatementReplacementMap;
|
|
112851
112867
|
let suppressNewDiagnosticContexts;
|
|
112852
112868
|
let exportedModulesFromDeclarationEmit;
|
|
112869
|
+
const usedBindingElementAliases = /* @__PURE__ */ new Map();
|
|
112853
112870
|
const { factory: factory2 } = context;
|
|
112854
112871
|
const host = context.getEmitHost();
|
|
112855
112872
|
const symbolTracker = {
|
|
@@ -112906,7 +112923,7 @@ function transformDeclarations(context) {
|
|
|
112906
112923
|
}
|
|
112907
112924
|
function handleSymbolAccessibilityError(symbolAccessibilityResult) {
|
|
112908
112925
|
if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
|
|
112909
|
-
if (symbolAccessibilityResult
|
|
112926
|
+
if (symbolAccessibilityResult.aliasesToMakeVisible) {
|
|
112910
112927
|
if (!lateMarkedStatements) {
|
|
112911
112928
|
lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible;
|
|
112912
112929
|
} else {
|
|
@@ -112915,6 +112932,17 @@ function transformDeclarations(context) {
|
|
|
112915
112932
|
}
|
|
112916
112933
|
}
|
|
112917
112934
|
}
|
|
112935
|
+
if (symbolAccessibilityResult.bindingElementToMakeVisible) {
|
|
112936
|
+
const bindingElement = symbolAccessibilityResult.bindingElementToMakeVisible;
|
|
112937
|
+
const parameter = findAncestor(bindingElement, isParameter);
|
|
112938
|
+
Debug.assert(parameter !== void 0);
|
|
112939
|
+
const parent2 = getOriginalNode(parameter.parent);
|
|
112940
|
+
let aliases = usedBindingElementAliases.get(parent2);
|
|
112941
|
+
if (!aliases) {
|
|
112942
|
+
usedBindingElementAliases.set(parent2, aliases = /* @__PURE__ */ new Map());
|
|
112943
|
+
}
|
|
112944
|
+
aliases.set(getOriginalNode(bindingElement), bindingElement.name);
|
|
112945
|
+
}
|
|
112918
112946
|
} else {
|
|
112919
112947
|
const errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
|
|
112920
112948
|
if (errorInfo) {
|
|
@@ -113264,7 +113292,7 @@ function transformDeclarations(context) {
|
|
|
113264
113292
|
if (elem.propertyName && isComputedPropertyName(elem.propertyName) && isEntityNameExpression(elem.propertyName.expression)) {
|
|
113265
113293
|
checkEntityNameVisibility(elem.propertyName.expression, enclosingDeclaration);
|
|
113266
113294
|
}
|
|
113267
|
-
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !
|
|
113295
|
+
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
113268
113296
|
return factory2.updateBindingElement(
|
|
113269
113297
|
elem,
|
|
113270
113298
|
elem.dotDotDotToken,
|
|
@@ -113283,6 +113311,161 @@ function transformDeclarations(context) {
|
|
|
113283
113311
|
);
|
|
113284
113312
|
}
|
|
113285
113313
|
}
|
|
113314
|
+
function ensureBindingAliasesInParameterList(input, updatedNode) {
|
|
113315
|
+
const original = getOriginalNode(input);
|
|
113316
|
+
const params = updatedNode.parameters;
|
|
113317
|
+
const aliases = usedBindingElementAliases.get(original);
|
|
113318
|
+
if (!aliases) {
|
|
113319
|
+
return updatedNode;
|
|
113320
|
+
}
|
|
113321
|
+
usedBindingElementAliases.delete(original);
|
|
113322
|
+
const newParams = map(params, addUsedBindingPatternsToParameter);
|
|
113323
|
+
const newParamsNodeArray = factory2.createNodeArray(newParams, params.hasTrailingComma);
|
|
113324
|
+
switch (updatedNode.kind) {
|
|
113325
|
+
case 174 /* MethodDeclaration */:
|
|
113326
|
+
return factory2.updateMethodDeclaration(
|
|
113327
|
+
updatedNode,
|
|
113328
|
+
updatedNode.modifiers,
|
|
113329
|
+
updatedNode.asteriskToken,
|
|
113330
|
+
updatedNode.name,
|
|
113331
|
+
updatedNode.questionToken,
|
|
113332
|
+
updatedNode.typeParameters,
|
|
113333
|
+
newParamsNodeArray,
|
|
113334
|
+
updatedNode.type,
|
|
113335
|
+
updatedNode.body
|
|
113336
|
+
);
|
|
113337
|
+
case 176 /* Constructor */:
|
|
113338
|
+
return factory2.updateConstructorDeclaration(
|
|
113339
|
+
updatedNode,
|
|
113340
|
+
updatedNode.modifiers,
|
|
113341
|
+
newParamsNodeArray,
|
|
113342
|
+
updatedNode.body
|
|
113343
|
+
);
|
|
113344
|
+
case 177 /* GetAccessor */:
|
|
113345
|
+
return factory2.updateGetAccessorDeclaration(
|
|
113346
|
+
updatedNode,
|
|
113347
|
+
updatedNode.modifiers,
|
|
113348
|
+
updatedNode.name,
|
|
113349
|
+
newParamsNodeArray,
|
|
113350
|
+
updatedNode.type,
|
|
113351
|
+
updatedNode.body
|
|
113352
|
+
);
|
|
113353
|
+
case 178 /* SetAccessor */:
|
|
113354
|
+
return factory2.updateSetAccessorDeclaration(
|
|
113355
|
+
updatedNode,
|
|
113356
|
+
updatedNode.modifiers,
|
|
113357
|
+
updatedNode.name,
|
|
113358
|
+
newParamsNodeArray,
|
|
113359
|
+
updatedNode.body
|
|
113360
|
+
);
|
|
113361
|
+
case 219 /* ArrowFunction */:
|
|
113362
|
+
return factory2.updateArrowFunction(
|
|
113363
|
+
updatedNode,
|
|
113364
|
+
updatedNode.modifiers,
|
|
113365
|
+
updatedNode.typeParameters,
|
|
113366
|
+
newParamsNodeArray,
|
|
113367
|
+
updatedNode.type,
|
|
113368
|
+
updatedNode.equalsGreaterThanToken,
|
|
113369
|
+
updatedNode.body
|
|
113370
|
+
);
|
|
113371
|
+
case 262 /* FunctionDeclaration */:
|
|
113372
|
+
return factory2.updateFunctionDeclaration(
|
|
113373
|
+
updatedNode,
|
|
113374
|
+
updatedNode.modifiers,
|
|
113375
|
+
updatedNode.asteriskToken,
|
|
113376
|
+
updatedNode.name,
|
|
113377
|
+
updatedNode.typeParameters,
|
|
113378
|
+
newParamsNodeArray,
|
|
113379
|
+
updatedNode.type,
|
|
113380
|
+
updatedNode.body
|
|
113381
|
+
);
|
|
113382
|
+
case 179 /* CallSignature */:
|
|
113383
|
+
return factory2.updateCallSignature(
|
|
113384
|
+
updatedNode,
|
|
113385
|
+
updatedNode.typeParameters,
|
|
113386
|
+
newParamsNodeArray,
|
|
113387
|
+
updatedNode.type
|
|
113388
|
+
);
|
|
113389
|
+
case 173 /* MethodSignature */:
|
|
113390
|
+
return factory2.updateMethodSignature(
|
|
113391
|
+
updatedNode,
|
|
113392
|
+
updatedNode.modifiers,
|
|
113393
|
+
updatedNode.name,
|
|
113394
|
+
updatedNode.questionToken,
|
|
113395
|
+
updatedNode.typeParameters,
|
|
113396
|
+
newParamsNodeArray,
|
|
113397
|
+
updatedNode.type
|
|
113398
|
+
);
|
|
113399
|
+
case 180 /* ConstructSignature */:
|
|
113400
|
+
return factory2.updateConstructSignature(
|
|
113401
|
+
updatedNode,
|
|
113402
|
+
updatedNode.typeParameters,
|
|
113403
|
+
newParamsNodeArray,
|
|
113404
|
+
updatedNode.type
|
|
113405
|
+
);
|
|
113406
|
+
case 184 /* FunctionType */:
|
|
113407
|
+
return factory2.updateFunctionTypeNode(
|
|
113408
|
+
updatedNode,
|
|
113409
|
+
updatedNode.typeParameters,
|
|
113410
|
+
newParamsNodeArray,
|
|
113411
|
+
updatedNode.type
|
|
113412
|
+
);
|
|
113413
|
+
case 185 /* ConstructorType */:
|
|
113414
|
+
return factory2.updateConstructorTypeNode(
|
|
113415
|
+
updatedNode,
|
|
113416
|
+
updatedNode.modifiers,
|
|
113417
|
+
updatedNode.typeParameters,
|
|
113418
|
+
newParamsNodeArray,
|
|
113419
|
+
updatedNode.type
|
|
113420
|
+
);
|
|
113421
|
+
default:
|
|
113422
|
+
Debug.assertNever(updatedNode);
|
|
113423
|
+
}
|
|
113424
|
+
function addUsedBindingPatternsToParameter(p) {
|
|
113425
|
+
return factory2.updateParameterDeclaration(
|
|
113426
|
+
p,
|
|
113427
|
+
p.modifiers,
|
|
113428
|
+
p.dotDotDotToken,
|
|
113429
|
+
addUsedBindingPatternAliases(p.name),
|
|
113430
|
+
p.questionToken,
|
|
113431
|
+
p.type,
|
|
113432
|
+
p.initializer
|
|
113433
|
+
);
|
|
113434
|
+
}
|
|
113435
|
+
function addUsedBindingPatternAliases(name) {
|
|
113436
|
+
if (name.kind === 80 /* Identifier */) {
|
|
113437
|
+
return name;
|
|
113438
|
+
} else {
|
|
113439
|
+
if (name.kind === 207 /* ArrayBindingPattern */) {
|
|
113440
|
+
return factory2.updateArrayBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isArrayBindingElement));
|
|
113441
|
+
} else {
|
|
113442
|
+
return factory2.updateObjectBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isBindingElement));
|
|
113443
|
+
}
|
|
113444
|
+
}
|
|
113445
|
+
function visitBindingElement(elem) {
|
|
113446
|
+
if (elem.kind === 232 /* OmittedExpression */) {
|
|
113447
|
+
return elem;
|
|
113448
|
+
}
|
|
113449
|
+
const usedAlias = aliases.get(getOriginalNode(elem));
|
|
113450
|
+
if (usedAlias && !elem.propertyName) {
|
|
113451
|
+
return factory2.updateBindingElement(
|
|
113452
|
+
elem,
|
|
113453
|
+
elem.dotDotDotToken,
|
|
113454
|
+
elem.name,
|
|
113455
|
+
usedAlias,
|
|
113456
|
+
elem.initializer
|
|
113457
|
+
);
|
|
113458
|
+
}
|
|
113459
|
+
return factory2.updateBindingElement(
|
|
113460
|
+
elem,
|
|
113461
|
+
elem.dotDotDotToken,
|
|
113462
|
+
elem.propertyName,
|
|
113463
|
+
addUsedBindingPatternAliases(elem.name),
|
|
113464
|
+
elem.initializer
|
|
113465
|
+
);
|
|
113466
|
+
}
|
|
113467
|
+
}
|
|
113468
|
+
}
|
|
113286
113469
|
function ensureParameter(p, modifierMask, type) {
|
|
113287
113470
|
let oldDiag;
|
|
113288
113471
|
if (!suppressNewDiagnosticContexts) {
|
|
@@ -113669,19 +113852,25 @@ function transformDeclarations(context) {
|
|
|
113669
113852
|
return cleanup(factory2.updateTypeReferenceNode(node, node.typeName, node.typeArguments));
|
|
113670
113853
|
}
|
|
113671
113854
|
case 180 /* ConstructSignature */:
|
|
113672
|
-
return cleanup(
|
|
113855
|
+
return cleanup(ensureBindingAliasesInParameterList(
|
|
113673
113856
|
input,
|
|
113674
|
-
|
|
113675
|
-
|
|
113676
|
-
|
|
113857
|
+
factory2.updateConstructSignature(
|
|
113858
|
+
input,
|
|
113859
|
+
ensureTypeParams(input, input.typeParameters),
|
|
113860
|
+
updateParamsList(input, input.parameters),
|
|
113861
|
+
ensureType(input, input.type)
|
|
113862
|
+
)
|
|
113677
113863
|
));
|
|
113678
113864
|
case 176 /* Constructor */: {
|
|
113679
|
-
const ctor =
|
|
113680
|
-
|
|
113681
|
-
|
|
113682
|
-
|
|
113683
|
-
|
|
113684
|
-
|
|
113865
|
+
const ctor = ensureBindingAliasesInParameterList(
|
|
113866
|
+
input,
|
|
113867
|
+
factory2.createConstructorDeclaration(
|
|
113868
|
+
/*modifiers*/
|
|
113869
|
+
ensureModifiers(input),
|
|
113870
|
+
updateParamsList(input, input.parameters, 0 /* None */),
|
|
113871
|
+
/*body*/
|
|
113872
|
+
void 0
|
|
113873
|
+
)
|
|
113685
113874
|
);
|
|
113686
113875
|
return cleanup(ctor);
|
|
113687
113876
|
}
|
|
@@ -113692,17 +113881,20 @@ function transformDeclarations(context) {
|
|
|
113692
113881
|
void 0
|
|
113693
113882
|
);
|
|
113694
113883
|
}
|
|
113695
|
-
const sig =
|
|
113696
|
-
|
|
113697
|
-
|
|
113698
|
-
|
|
113699
|
-
|
|
113700
|
-
|
|
113701
|
-
|
|
113702
|
-
|
|
113703
|
-
|
|
113704
|
-
|
|
113705
|
-
|
|
113884
|
+
const sig = ensureBindingAliasesInParameterList(
|
|
113885
|
+
input,
|
|
113886
|
+
factory2.createMethodDeclaration(
|
|
113887
|
+
ensureModifiers(input),
|
|
113888
|
+
/*asteriskToken*/
|
|
113889
|
+
void 0,
|
|
113890
|
+
input.name,
|
|
113891
|
+
input.questionToken,
|
|
113892
|
+
ensureTypeParams(input, input.typeParameters),
|
|
113893
|
+
updateParamsList(input, input.parameters),
|
|
113894
|
+
ensureType(input, input.type),
|
|
113895
|
+
/*body*/
|
|
113896
|
+
void 0
|
|
113897
|
+
)
|
|
113706
113898
|
);
|
|
113707
113899
|
return cleanup(sig);
|
|
113708
113900
|
}
|
|
@@ -113714,14 +113906,17 @@ function transformDeclarations(context) {
|
|
|
113714
113906
|
);
|
|
113715
113907
|
}
|
|
113716
113908
|
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
|
|
113717
|
-
return cleanup(
|
|
113909
|
+
return cleanup(ensureBindingAliasesInParameterList(
|
|
113718
113910
|
input,
|
|
113719
|
-
|
|
113720
|
-
|
|
113721
|
-
|
|
113722
|
-
|
|
113723
|
-
|
|
113724
|
-
|
|
113911
|
+
factory2.updateGetAccessorDeclaration(
|
|
113912
|
+
input,
|
|
113913
|
+
ensureModifiers(input),
|
|
113914
|
+
input.name,
|
|
113915
|
+
updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
|
|
113916
|
+
ensureType(input, accessorType),
|
|
113917
|
+
/*body*/
|
|
113918
|
+
void 0
|
|
113919
|
+
)
|
|
113725
113920
|
));
|
|
113726
113921
|
}
|
|
113727
113922
|
case 178 /* SetAccessor */: {
|
|
@@ -113731,13 +113926,16 @@ function transformDeclarations(context) {
|
|
|
113731
113926
|
void 0
|
|
113732
113927
|
);
|
|
113733
113928
|
}
|
|
113734
|
-
return cleanup(
|
|
113929
|
+
return cleanup(ensureBindingAliasesInParameterList(
|
|
113735
113930
|
input,
|
|
113736
|
-
|
|
113737
|
-
|
|
113738
|
-
|
|
113739
|
-
|
|
113740
|
-
|
|
113931
|
+
factory2.updateSetAccessorDeclaration(
|
|
113932
|
+
input,
|
|
113933
|
+
ensureModifiers(input),
|
|
113934
|
+
input.name,
|
|
113935
|
+
updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
|
|
113936
|
+
/*body*/
|
|
113937
|
+
void 0
|
|
113938
|
+
)
|
|
113741
113939
|
));
|
|
113742
113940
|
}
|
|
113743
113941
|
case 172 /* PropertyDeclaration */:
|
|
@@ -113776,22 +113974,28 @@ function transformDeclarations(context) {
|
|
|
113776
113974
|
void 0
|
|
113777
113975
|
);
|
|
113778
113976
|
}
|
|
113779
|
-
return cleanup(
|
|
113977
|
+
return cleanup(ensureBindingAliasesInParameterList(
|
|
113780
113978
|
input,
|
|
113781
|
-
|
|
113782
|
-
|
|
113783
|
-
|
|
113784
|
-
|
|
113785
|
-
|
|
113786
|
-
|
|
113979
|
+
factory2.updateMethodSignature(
|
|
113980
|
+
input,
|
|
113981
|
+
ensureModifiers(input),
|
|
113982
|
+
input.name,
|
|
113983
|
+
input.questionToken,
|
|
113984
|
+
ensureTypeParams(input, input.typeParameters),
|
|
113985
|
+
updateParamsList(input, input.parameters),
|
|
113986
|
+
ensureType(input, input.type)
|
|
113987
|
+
)
|
|
113787
113988
|
));
|
|
113788
113989
|
}
|
|
113789
113990
|
case 179 /* CallSignature */: {
|
|
113790
|
-
return cleanup(
|
|
113991
|
+
return cleanup(ensureBindingAliasesInParameterList(
|
|
113791
113992
|
input,
|
|
113792
|
-
|
|
113793
|
-
|
|
113794
|
-
|
|
113993
|
+
factory2.updateCallSignature(
|
|
113994
|
+
input,
|
|
113995
|
+
ensureTypeParams(input, input.typeParameters),
|
|
113996
|
+
updateParamsList(input, input.parameters),
|
|
113997
|
+
ensureType(input, input.type)
|
|
113998
|
+
)
|
|
113795
113999
|
));
|
|
113796
114000
|
}
|
|
113797
114001
|
case 181 /* IndexSignature */: {
|
|
@@ -113846,10 +114050,27 @@ function transformDeclarations(context) {
|
|
|
113846
114050
|
return cleanup(factory2.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
|
|
113847
114051
|
}
|
|
113848
114052
|
case 184 /* FunctionType */: {
|
|
113849
|
-
return cleanup(
|
|
114053
|
+
return cleanup(ensureBindingAliasesInParameterList(
|
|
114054
|
+
input,
|
|
114055
|
+
factory2.updateFunctionTypeNode(
|
|
114056
|
+
input,
|
|
114057
|
+
visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
|
|
114058
|
+
updateParamsList(input, input.parameters),
|
|
114059
|
+
Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
|
|
114060
|
+
)
|
|
114061
|
+
));
|
|
113850
114062
|
}
|
|
113851
114063
|
case 185 /* ConstructorType */: {
|
|
113852
|
-
return cleanup(
|
|
114064
|
+
return cleanup(ensureBindingAliasesInParameterList(
|
|
114065
|
+
input,
|
|
114066
|
+
factory2.updateConstructorTypeNode(
|
|
114067
|
+
input,
|
|
114068
|
+
ensureModifiers(input),
|
|
114069
|
+
visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
|
|
114070
|
+
updateParamsList(input, input.parameters),
|
|
114071
|
+
Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
|
|
114072
|
+
)
|
|
114073
|
+
));
|
|
113853
114074
|
}
|
|
113854
114075
|
case 205 /* ImportType */: {
|
|
113855
114076
|
if (!isLiteralImportTypeNode(input))
|
|
@@ -114034,17 +114255,20 @@ function transformDeclarations(context) {
|
|
|
114034
114255
|
));
|
|
114035
114256
|
}
|
|
114036
114257
|
case 262 /* FunctionDeclaration */: {
|
|
114037
|
-
const clean2 = cleanup(
|
|
114258
|
+
const clean2 = cleanup(ensureBindingAliasesInParameterList(
|
|
114038
114259
|
input,
|
|
114039
|
-
|
|
114040
|
-
|
|
114041
|
-
|
|
114042
|
-
|
|
114043
|
-
|
|
114044
|
-
|
|
114045
|
-
|
|
114046
|
-
|
|
114047
|
-
|
|
114260
|
+
factory2.updateFunctionDeclaration(
|
|
114261
|
+
input,
|
|
114262
|
+
ensureModifiers(input),
|
|
114263
|
+
/*asteriskToken*/
|
|
114264
|
+
void 0,
|
|
114265
|
+
input.name,
|
|
114266
|
+
ensureTypeParams(input, input.typeParameters),
|
|
114267
|
+
updateParamsList(input, input.parameters),
|
|
114268
|
+
ensureType(input, input.type),
|
|
114269
|
+
/*body*/
|
|
114270
|
+
void 0
|
|
114271
|
+
)
|
|
114048
114272
|
));
|
|
114049
114273
|
if (clean2 && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) {
|
|
114050
114274
|
const props = resolver.getPropertiesOfContainerFunction(input);
|
|
@@ -140109,7 +140333,7 @@ function doChange4(context, oldFile, targetFile, program, toMove, changes, host,
|
|
|
140109
140333
|
} else {
|
|
140110
140334
|
const targetSourceFile = Debug.checkDefined(program.getSourceFile(targetFile));
|
|
140111
140335
|
const importAdder = ts_codefix_exports.createImportAdder(targetSourceFile, context.program, context.preferences, context.host);
|
|
140112
|
-
getNewStatementsAndRemoveFromOldFile2(oldFile, targetSourceFile, getUsageInfo(oldFile, toMove.all, checker,
|
|
140336
|
+
getNewStatementsAndRemoveFromOldFile2(oldFile, targetSourceFile, getUsageInfo(oldFile, toMove.all, checker, getExistingLocals(targetSourceFile, toMove.all, checker)), changes, toMove, program, host, preferences, importAdder);
|
|
140113
140337
|
}
|
|
140114
140338
|
}
|
|
140115
140339
|
function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences, importAdder) {
|
|
@@ -140775,7 +140999,7 @@ function isPureImport(node) {
|
|
|
140775
140999
|
return false;
|
|
140776
141000
|
}
|
|
140777
141001
|
}
|
|
140778
|
-
function getUsageInfo(oldFile, toMove, checker,
|
|
141002
|
+
function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PURE__ */ new Set()) {
|
|
140779
141003
|
const movedSymbols = /* @__PURE__ */ new Set();
|
|
140780
141004
|
const oldImportsNeededByTargetFile = /* @__PURE__ */ new Map();
|
|
140781
141005
|
const targetFileImportsFromOldFile = /* @__PURE__ */ new Set();
|
|
@@ -140795,7 +141019,7 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetImports = /* @__PU
|
|
|
140795
141019
|
if (!symbol.declarations) {
|
|
140796
141020
|
return;
|
|
140797
141021
|
}
|
|
140798
|
-
if (
|
|
141022
|
+
if (existingTargetLocals.has(skipAlias(symbol, checker))) {
|
|
140799
141023
|
unusedImportsFromOldFile.add(symbol);
|
|
140800
141024
|
return;
|
|
140801
141025
|
}
|
|
@@ -140997,15 +141221,15 @@ function getOverloadRangeToMove(sourceFile, statement) {
|
|
|
140997
141221
|
}
|
|
140998
141222
|
return void 0;
|
|
140999
141223
|
}
|
|
141000
|
-
function
|
|
141001
|
-
const
|
|
141224
|
+
function getExistingLocals(sourceFile, statements, checker) {
|
|
141225
|
+
const existingLocals = /* @__PURE__ */ new Set();
|
|
141002
141226
|
for (const moduleSpecifier of sourceFile.imports) {
|
|
141003
141227
|
const declaration = importFromModuleSpecifier(moduleSpecifier);
|
|
141004
141228
|
if (isImportDeclaration(declaration) && declaration.importClause && declaration.importClause.namedBindings && isNamedImports(declaration.importClause.namedBindings)) {
|
|
141005
141229
|
for (const e of declaration.importClause.namedBindings.elements) {
|
|
141006
141230
|
const symbol = checker.getSymbolAtLocation(e.propertyName || e.name);
|
|
141007
141231
|
if (symbol) {
|
|
141008
|
-
|
|
141232
|
+
existingLocals.add(skipAlias(symbol, checker));
|
|
141009
141233
|
}
|
|
141010
141234
|
}
|
|
141011
141235
|
}
|
|
@@ -141013,12 +141237,20 @@ function getExistingImports(sourceFile, checker) {
|
|
|
141013
141237
|
for (const e of declaration.parent.name.elements) {
|
|
141014
141238
|
const symbol = checker.getSymbolAtLocation(e.propertyName || e.name);
|
|
141015
141239
|
if (symbol) {
|
|
141016
|
-
|
|
141240
|
+
existingLocals.add(skipAlias(symbol, checker));
|
|
141017
141241
|
}
|
|
141018
141242
|
}
|
|
141019
141243
|
}
|
|
141020
141244
|
}
|
|
141021
|
-
|
|
141245
|
+
for (const statement of statements) {
|
|
141246
|
+
forEachReference(statement, checker, (s) => {
|
|
141247
|
+
const symbol = skipAlias(s, checker);
|
|
141248
|
+
if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration) === sourceFile) {
|
|
141249
|
+
existingLocals.add(symbol);
|
|
141250
|
+
}
|
|
141251
|
+
});
|
|
141252
|
+
}
|
|
141253
|
+
return existingLocals;
|
|
141022
141254
|
}
|
|
141023
141255
|
|
|
141024
141256
|
// src/services/_namespaces/ts.refactor.addOrRemoveBracesToArrowFunction.ts
|
|
@@ -166401,15 +166633,17 @@ function getJsDocTagsFromDeclarations(declarations, checker) {
|
|
|
166401
166633
|
}
|
|
166402
166634
|
for (const tag of tags) {
|
|
166403
166635
|
infos.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) });
|
|
166404
|
-
|
|
166405
|
-
forEach(tag.typeExpression.type.jsDocPropertyTags, (propTag) => {
|
|
166406
|
-
infos.push({ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) });
|
|
166407
|
-
});
|
|
166408
|
-
}
|
|
166636
|
+
infos.push(...getJSDocPropertyTagsInfo(tryGetJSDocPropertyTags(tag), checker));
|
|
166409
166637
|
}
|
|
166410
166638
|
});
|
|
166411
166639
|
return infos;
|
|
166412
166640
|
}
|
|
166641
|
+
function getJSDocPropertyTagsInfo(nodes, checker) {
|
|
166642
|
+
return flatMap(nodes, (propTag) => concatenate([{ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) }], getJSDocPropertyTagsInfo(tryGetJSDocPropertyTags(propTag), checker)));
|
|
166643
|
+
}
|
|
166644
|
+
function tryGetJSDocPropertyTags(node) {
|
|
166645
|
+
return isJSDocPropertyLikeTag(node) && node.isNameFirst && node.typeExpression && isJSDocTypeLiteral(node.typeExpression.type) ? node.typeExpression.type.jsDocPropertyTags : void 0;
|
|
166646
|
+
}
|
|
166413
166647
|
function getDisplayPartsFromComment(comment, checker) {
|
|
166414
166648
|
if (typeof comment === "string") {
|
|
166415
166649
|
return [textPart(comment)];
|