typescript 5.2.0-dev.20230531 → 5.2.0-dev.20230602
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 +81 -35
- package/lib/tsserver.js +140 -42
- package/lib/tsserverlibrary.js +140 -42
- package/lib/typescript.js +140 -42
- package/lib/typingsInstaller.js +8 -3
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2304
2304
|
|
|
2305
2305
|
// src/compiler/corePublic.ts
|
|
2306
2306
|
var versionMajorMinor = "5.2";
|
|
2307
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-dev.20230602`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9494,8 +9494,6 @@ var Diagnostics = {
|
|
|
9494
9494
|
Class_constructor_may_not_be_a_generator: diag(1368, 1 /* Error */, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."),
|
|
9495
9495
|
Did_you_mean_0: diag(1369, 3 /* Message */, "Did_you_mean_0_1369", "Did you mean '{0}'?"),
|
|
9496
9496
|
This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, 1 /* Error */, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."),
|
|
9497
|
-
Convert_to_type_only_import: diag(1373, 3 /* Message */, "Convert_to_type_only_import_1373", "Convert to type-only import"),
|
|
9498
|
-
Convert_all_imports_not_used_as_a_value_to_type_only_imports: diag(1374, 3 /* Message */, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"),
|
|
9499
9497
|
await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
9500
9498
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
9501
9499
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
@@ -10701,6 +10699,8 @@ var Diagnostics = {
|
|
|
10701
10699
|
Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
|
|
10702
10700
|
Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
|
|
10703
10701
|
Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
|
|
10702
|
+
Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."),
|
|
10703
|
+
Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
|
|
10704
10704
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
10705
10705
|
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
10706
10706
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -11213,6 +11213,9 @@ var Diagnostics = {
|
|
|
11213
11213
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
11214
11214
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
11215
11215
|
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
|
|
11216
|
+
Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
|
|
11217
|
+
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
11218
|
+
Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
|
|
11216
11219
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
11217
11220
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
11218
11221
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -43080,11 +43083,13 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
|
|
|
43080
43083
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
43081
43084
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
43082
43085
|
if (priorityExtensions) {
|
|
43086
|
+
traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0, formatExtensions(priorityExtensions));
|
|
43083
43087
|
const result = lookup(priorityExtensions);
|
|
43084
43088
|
if (result)
|
|
43085
43089
|
return result;
|
|
43086
43090
|
}
|
|
43087
43091
|
if (secondaryExtensions && !typesScopeOnly) {
|
|
43092
|
+
traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0, formatExtensions(secondaryExtensions));
|
|
43088
43093
|
return lookup(secondaryExtensions);
|
|
43089
43094
|
}
|
|
43090
43095
|
function lookup(extensions2) {
|
|
@@ -69365,6 +69370,8 @@ function createTypeChecker(host) {
|
|
|
69365
69370
|
}
|
|
69366
69371
|
function isConstantReference(node) {
|
|
69367
69372
|
switch (node.kind) {
|
|
69373
|
+
case 110 /* ThisKeyword */:
|
|
69374
|
+
return true;
|
|
69368
69375
|
case 80 /* Identifier */:
|
|
69369
69376
|
if (!isThisInTypeQuery(node)) {
|
|
69370
69377
|
const symbol = getResolvedSymbol(node);
|
|
@@ -92635,8 +92642,9 @@ function transformClassFields(context) {
|
|
|
92635
92642
|
let pendingStatements;
|
|
92636
92643
|
let lexicalEnvironment;
|
|
92637
92644
|
const lexicalEnvironmentMap = /* @__PURE__ */ new Map();
|
|
92645
|
+
const noSubstitution = /* @__PURE__ */ new Set();
|
|
92638
92646
|
let currentClassContainer;
|
|
92639
|
-
let
|
|
92647
|
+
let currentClassElement;
|
|
92640
92648
|
let shouldSubstituteThisWithClassThis = false;
|
|
92641
92649
|
let previousShouldSubstituteThisWithClassThis = false;
|
|
92642
92650
|
return chainBundle(context, transformSourceFile);
|
|
@@ -92728,13 +92736,18 @@ function transformClassFields(context) {
|
|
|
92728
92736
|
return visitForStatement(node);
|
|
92729
92737
|
case 261 /* FunctionDeclaration */:
|
|
92730
92738
|
case 217 /* FunctionExpression */:
|
|
92739
|
+
return setCurrentClassElementAnd(
|
|
92740
|
+
/*classElement*/
|
|
92741
|
+
void 0,
|
|
92742
|
+
fallbackVisitor,
|
|
92743
|
+
node
|
|
92744
|
+
);
|
|
92731
92745
|
case 175 /* Constructor */:
|
|
92732
92746
|
case 173 /* MethodDeclaration */:
|
|
92733
92747
|
case 176 /* GetAccessor */:
|
|
92734
92748
|
case 177 /* SetAccessor */: {
|
|
92735
|
-
return
|
|
92736
|
-
|
|
92737
|
-
void 0,
|
|
92749
|
+
return setCurrentClassElementAnd(
|
|
92750
|
+
node,
|
|
92738
92751
|
fallbackVisitor,
|
|
92739
92752
|
node
|
|
92740
92753
|
);
|
|
@@ -92823,25 +92836,31 @@ function transformClassFields(context) {
|
|
|
92823
92836
|
function classElementVisitor(node) {
|
|
92824
92837
|
switch (node.kind) {
|
|
92825
92838
|
case 175 /* Constructor */:
|
|
92826
|
-
return
|
|
92839
|
+
return setCurrentClassElementAnd(
|
|
92840
|
+
node,
|
|
92841
|
+
visitConstructorDeclaration,
|
|
92842
|
+
node
|
|
92843
|
+
);
|
|
92827
92844
|
case 176 /* GetAccessor */:
|
|
92828
92845
|
case 177 /* SetAccessor */:
|
|
92829
92846
|
case 173 /* MethodDeclaration */:
|
|
92830
|
-
return
|
|
92831
|
-
|
|
92832
|
-
void 0,
|
|
92847
|
+
return setCurrentClassElementAnd(
|
|
92848
|
+
node,
|
|
92833
92849
|
visitMethodOrAccessorDeclaration,
|
|
92834
92850
|
node
|
|
92835
92851
|
);
|
|
92836
92852
|
case 171 /* PropertyDeclaration */:
|
|
92837
|
-
return
|
|
92838
|
-
|
|
92839
|
-
void 0,
|
|
92853
|
+
return setCurrentClassElementAnd(
|
|
92854
|
+
node,
|
|
92840
92855
|
visitPropertyDeclaration,
|
|
92841
92856
|
node
|
|
92842
92857
|
);
|
|
92843
92858
|
case 174 /* ClassStaticBlockDeclaration */:
|
|
92844
|
-
return
|
|
92859
|
+
return setCurrentClassElementAnd(
|
|
92860
|
+
node,
|
|
92861
|
+
visitClassStaticBlockDeclaration,
|
|
92862
|
+
node
|
|
92863
|
+
);
|
|
92845
92864
|
case 166 /* ComputedPropertyName */:
|
|
92846
92865
|
return visitComputedPropertyName(node);
|
|
92847
92866
|
case 239 /* SemicolonClassElement */:
|
|
@@ -93035,12 +93054,15 @@ function transformClassFields(context) {
|
|
|
93035
93054
|
}
|
|
93036
93055
|
return void 0;
|
|
93037
93056
|
}
|
|
93038
|
-
function
|
|
93039
|
-
|
|
93040
|
-
|
|
93041
|
-
|
|
93042
|
-
|
|
93043
|
-
|
|
93057
|
+
function setCurrentClassElementAnd(classElement, visitor2, arg) {
|
|
93058
|
+
if (classElement !== currentClassElement) {
|
|
93059
|
+
const savedCurrentClassElement = currentClassElement;
|
|
93060
|
+
currentClassElement = classElement;
|
|
93061
|
+
const result = visitor2(arg);
|
|
93062
|
+
currentClassElement = savedCurrentClassElement;
|
|
93063
|
+
return result;
|
|
93064
|
+
}
|
|
93065
|
+
return visitor2(arg);
|
|
93044
93066
|
}
|
|
93045
93067
|
function getHoistedFunctionName(node) {
|
|
93046
93068
|
Debug.assert(isPrivateIdentifier(node.name));
|
|
@@ -93202,8 +93224,21 @@ function transformClassFields(context) {
|
|
|
93202
93224
|
}
|
|
93203
93225
|
return transformFieldInitializer(node);
|
|
93204
93226
|
}
|
|
93227
|
+
function shouldForceDynamicThis() {
|
|
93228
|
+
return !!currentClassElement && hasStaticModifier(currentClassElement) && isAccessor(currentClassElement) && isAutoAccessorPropertyDeclaration(getOriginalNode(currentClassElement));
|
|
93229
|
+
}
|
|
93230
|
+
function ensureDynamicThisIfNeeded(node) {
|
|
93231
|
+
if (shouldForceDynamicThis()) {
|
|
93232
|
+
const innerExpression = skipOuterExpressions(node);
|
|
93233
|
+
if (innerExpression.kind === 110 /* ThisKeyword */) {
|
|
93234
|
+
noSubstitution.add(innerExpression);
|
|
93235
|
+
}
|
|
93236
|
+
}
|
|
93237
|
+
}
|
|
93205
93238
|
function createPrivateIdentifierAccess(info, receiver) {
|
|
93206
|
-
|
|
93239
|
+
receiver = visitNode(receiver, visitor, isExpression);
|
|
93240
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
93241
|
+
return createPrivateIdentifierAccessHelper(info, receiver);
|
|
93207
93242
|
}
|
|
93208
93243
|
function createPrivateIdentifierAccessHelper(info, receiver) {
|
|
93209
93244
|
setCommentRange(receiver, moveRangePos(receiver, -1));
|
|
@@ -93248,7 +93283,7 @@ function transformClassFields(context) {
|
|
|
93248
93283
|
);
|
|
93249
93284
|
}
|
|
93250
93285
|
}
|
|
93251
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && isIdentifier(node.name) &&
|
|
93286
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
93252
93287
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
93253
93288
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
93254
93289
|
return visitInvalidSuperProperty(node);
|
|
@@ -93267,7 +93302,7 @@ function transformClassFields(context) {
|
|
|
93267
93302
|
return visitEachChild(node, visitor, context);
|
|
93268
93303
|
}
|
|
93269
93304
|
function visitElementAccessExpression(node) {
|
|
93270
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
93305
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
93271
93306
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
93272
93307
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
93273
93308
|
return visitInvalidSuperProperty(node);
|
|
@@ -93292,6 +93327,7 @@ function transformClassFields(context) {
|
|
|
93292
93327
|
let info;
|
|
93293
93328
|
if (info = accessPrivateIdentifier2(operand.name)) {
|
|
93294
93329
|
const receiver = visitNode(operand.expression, visitor, isExpression);
|
|
93330
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
93295
93331
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
93296
93332
|
let expression = createPrivateIdentifierAccess(info, readExpression);
|
|
93297
93333
|
const temp = isPrefixUnaryExpression(node) || discarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration);
|
|
@@ -93310,7 +93346,7 @@ function transformClassFields(context) {
|
|
|
93310
93346
|
}
|
|
93311
93347
|
return expression;
|
|
93312
93348
|
}
|
|
93313
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(operand) &&
|
|
93349
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(operand) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
93314
93350
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
93315
93351
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
93316
93352
|
const expression = visitInvalidSuperProperty(operand);
|
|
@@ -93367,6 +93403,9 @@ function transformClassFields(context) {
|
|
|
93367
93403
|
}
|
|
93368
93404
|
function createCopiableReceiverExpr(receiver) {
|
|
93369
93405
|
const clone2 = nodeIsSynthesized(receiver) ? receiver : factory2.cloneNode(receiver);
|
|
93406
|
+
if (receiver.kind === 110 /* ThisKeyword */ && noSubstitution.has(receiver)) {
|
|
93407
|
+
noSubstitution.add(clone2);
|
|
93408
|
+
}
|
|
93370
93409
|
if (isSimpleInlineableExpression(receiver)) {
|
|
93371
93410
|
return { readExpression: clone2, initializeExpression: void 0 };
|
|
93372
93411
|
}
|
|
@@ -93397,7 +93436,7 @@ function transformClassFields(context) {
|
|
|
93397
93436
|
[visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)]
|
|
93398
93437
|
);
|
|
93399
93438
|
}
|
|
93400
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) &&
|
|
93439
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.expression) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
93401
93440
|
const invocation = factory2.createFunctionCallCall(
|
|
93402
93441
|
visitNode(node.expression, visitor, isExpression),
|
|
93403
93442
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -93426,7 +93465,7 @@ function transformClassFields(context) {
|
|
|
93426
93465
|
visitNode(node.template, visitor, isTemplateLiteral)
|
|
93427
93466
|
);
|
|
93428
93467
|
}
|
|
93429
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) &&
|
|
93468
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.tag) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
93430
93469
|
const invocation = factory2.createFunctionBindCall(
|
|
93431
93470
|
visitNode(node.tag, visitor, isExpression),
|
|
93432
93471
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -93450,7 +93489,7 @@ function transformClassFields(context) {
|
|
|
93450
93489
|
}
|
|
93451
93490
|
if (shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
93452
93491
|
startLexicalEnvironment();
|
|
93453
|
-
let statements =
|
|
93492
|
+
let statements = setCurrentClassElementAnd(
|
|
93454
93493
|
node,
|
|
93455
93494
|
(statements2) => visitNodes2(statements2, visitor, isStatement),
|
|
93456
93495
|
node.body.statements
|
|
@@ -93512,7 +93551,7 @@ function transformClassFields(context) {
|
|
|
93512
93551
|
node
|
|
93513
93552
|
);
|
|
93514
93553
|
}
|
|
93515
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.left) &&
|
|
93554
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.left) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
93516
93555
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
93517
93556
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
93518
93557
|
return factory2.updateBinaryExpression(
|
|
@@ -93607,6 +93646,7 @@ function transformClassFields(context) {
|
|
|
93607
93646
|
function createPrivateIdentifierAssignment(info, receiver, right, operator) {
|
|
93608
93647
|
receiver = visitNode(receiver, visitor, isExpression);
|
|
93609
93648
|
right = visitNode(right, visitor, isExpression);
|
|
93649
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
93610
93650
|
if (isCompoundAssignment(operator)) {
|
|
93611
93651
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
93612
93652
|
receiver = initializeExpression || readExpression;
|
|
@@ -94249,7 +94289,7 @@ function transformClassFields(context) {
|
|
|
94249
94289
|
}
|
|
94250
94290
|
function transformProperty(property, receiver) {
|
|
94251
94291
|
var _a;
|
|
94252
|
-
const
|
|
94292
|
+
const savedCurrentClassElement = currentClassElement;
|
|
94253
94293
|
const transformed = transformPropertyWorker(property, receiver);
|
|
94254
94294
|
if (transformed && hasStaticModifier(property) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts)) {
|
|
94255
94295
|
setOriginalNode(transformed, property);
|
|
@@ -94257,7 +94297,7 @@ function transformClassFields(context) {
|
|
|
94257
94297
|
setSourceMapRange(transformed, getSourceMapRange(property.name));
|
|
94258
94298
|
lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment);
|
|
94259
94299
|
}
|
|
94260
|
-
|
|
94300
|
+
currentClassElement = savedCurrentClassElement;
|
|
94261
94301
|
return transformed;
|
|
94262
94302
|
}
|
|
94263
94303
|
function transformPropertyWorker(property, receiver) {
|
|
@@ -94274,7 +94314,7 @@ function transformClassFields(context) {
|
|
|
94274
94314
|
}
|
|
94275
94315
|
const propertyName = hasAccessorModifier(property) ? factory2.getGeneratedPrivateNameForNode(property.name) : isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? factory2.updateComputedPropertyName(property.name, factory2.getGeneratedNameForNode(property.name)) : property.name;
|
|
94276
94316
|
if (hasStaticModifier(property)) {
|
|
94277
|
-
|
|
94317
|
+
currentClassElement = property;
|
|
94278
94318
|
}
|
|
94279
94319
|
const initializerVisitor = referencedName ? (child) => namedEvaluationVisitor(child, referencedName) : visitor;
|
|
94280
94320
|
if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property)) {
|
|
@@ -94599,7 +94639,7 @@ function transformClassFields(context) {
|
|
|
94599
94639
|
}
|
|
94600
94640
|
if (isPrivateIdentifierPropertyAccessExpression(node)) {
|
|
94601
94641
|
return wrapPrivateIdentifierForDestructuringTarget(node);
|
|
94602
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
94642
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
94603
94643
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
94604
94644
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
94605
94645
|
return visitInvalidSuperProperty(node);
|
|
@@ -94779,7 +94819,7 @@ function transformClassFields(context) {
|
|
|
94779
94819
|
return node;
|
|
94780
94820
|
}
|
|
94781
94821
|
function substituteThisExpression(node) {
|
|
94782
|
-
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
94822
|
+
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) && !noSubstitution.has(node)) {
|
|
94783
94823
|
const { facts, classConstructor, classThis } = lexicalEnvironment.data;
|
|
94784
94824
|
if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) {
|
|
94785
94825
|
return factory2.createParenthesizedExpression(factory2.createVoidZero());
|
|
@@ -94848,6 +94888,12 @@ function isReservedPrivateName(node) {
|
|
|
94848
94888
|
function isPrivateIdentifierInExpression(node) {
|
|
94849
94889
|
return isPrivateIdentifier(node.left) && node.operatorToken.kind === 103 /* InKeyword */;
|
|
94850
94890
|
}
|
|
94891
|
+
function isStaticPropertyDeclaration2(node) {
|
|
94892
|
+
return isPropertyDeclaration(node) && hasStaticModifier(node);
|
|
94893
|
+
}
|
|
94894
|
+
function isStaticPropertyDeclarationOrClassStaticBlock(node) {
|
|
94895
|
+
return isClassStaticBlockDeclaration(node) || isStaticPropertyDeclaration2(node);
|
|
94896
|
+
}
|
|
94851
94897
|
|
|
94852
94898
|
// src/compiler/transformers/typeSerializer.ts
|
|
94853
94899
|
function createRuntimeTypeSerializer(context) {
|
|
@@ -100182,7 +100228,7 @@ function transformJsx(context) {
|
|
|
100182
100228
|
continue;
|
|
100183
100229
|
}
|
|
100184
100230
|
finishObjectLiteralIfNeeded();
|
|
100185
|
-
expressions.push(attr.expression);
|
|
100231
|
+
expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
|
|
100186
100232
|
continue;
|
|
100187
100233
|
}
|
|
100188
100234
|
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
@@ -147560,19 +147606,41 @@ var fixId13 = "convertToTypeOnlyImport";
|
|
|
147560
147606
|
registerCodeFix({
|
|
147561
147607
|
errorCodes: errorCodes14,
|
|
147562
147608
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
147609
|
+
var _a;
|
|
147563
147610
|
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
147564
147611
|
if (declaration) {
|
|
147565
147612
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
|
|
147566
|
-
|
|
147613
|
+
const importDeclarationChanges = declaration.kind === 275 /* ImportSpecifier */ && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0;
|
|
147614
|
+
const mainAction = createCodeFixAction(
|
|
147615
|
+
fixId13,
|
|
147616
|
+
changes,
|
|
147617
|
+
declaration.kind === 275 /* ImportSpecifier */ ? [Diagnostics.Use_type_0, ((_a = declaration.propertyName) == null ? void 0 : _a.text) ?? declaration.name.text] : Diagnostics.Use_import_type,
|
|
147618
|
+
fixId13,
|
|
147619
|
+
Diagnostics.Fix_all_with_type_only_imports
|
|
147620
|
+
);
|
|
147621
|
+
if (some(importDeclarationChanges)) {
|
|
147622
|
+
return [
|
|
147623
|
+
createCodeFixActionWithoutFixAll(fixId13, importDeclarationChanges, Diagnostics.Use_import_type),
|
|
147624
|
+
mainAction
|
|
147625
|
+
];
|
|
147626
|
+
}
|
|
147627
|
+
return [mainAction];
|
|
147567
147628
|
}
|
|
147568
147629
|
return void 0;
|
|
147569
147630
|
},
|
|
147570
147631
|
fixIds: [fixId13],
|
|
147571
147632
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
147633
|
+
const fixedImportDeclarations = /* @__PURE__ */ new Set();
|
|
147572
147634
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
147573
|
-
const
|
|
147574
|
-
if (
|
|
147575
|
-
doChange11(changes, diag2.file,
|
|
147635
|
+
const errorDeclaration = getDeclaration2(diag2.file, diag2.start);
|
|
147636
|
+
if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 271 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
|
|
147637
|
+
doChange11(changes, diag2.file, errorDeclaration);
|
|
147638
|
+
fixedImportDeclarations.add(errorDeclaration);
|
|
147639
|
+
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
|
|
147640
|
+
doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
|
|
147641
|
+
fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
|
|
147642
|
+
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */) {
|
|
147643
|
+
doChange11(changes, diag2.file, errorDeclaration);
|
|
147576
147644
|
}
|
|
147577
147645
|
});
|
|
147578
147646
|
}
|
|
@@ -147581,7 +147649,27 @@ function getDeclaration2(sourceFile, pos) {
|
|
|
147581
147649
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
147582
147650
|
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
147583
147651
|
}
|
|
147652
|
+
function canConvertImportDeclarationForSpecifier(specifier, sourceFile, program) {
|
|
147653
|
+
if (specifier.parent.parent.name) {
|
|
147654
|
+
return false;
|
|
147655
|
+
}
|
|
147656
|
+
const nonTypeOnlySpecifiers = specifier.parent.elements.filter((e) => !e.isTypeOnly);
|
|
147657
|
+
if (nonTypeOnlySpecifiers.length === 1) {
|
|
147658
|
+
return true;
|
|
147659
|
+
}
|
|
147660
|
+
const checker = program.getTypeChecker();
|
|
147661
|
+
for (const specifier2 of nonTypeOnlySpecifiers) {
|
|
147662
|
+
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage) => {
|
|
147663
|
+
return !isValidTypeOnlyAliasUseSite(usage);
|
|
147664
|
+
});
|
|
147665
|
+
if (isUsedAsValue) {
|
|
147666
|
+
return false;
|
|
147667
|
+
}
|
|
147668
|
+
}
|
|
147669
|
+
return true;
|
|
147670
|
+
}
|
|
147584
147671
|
function doChange11(changes, sourceFile, declaration) {
|
|
147672
|
+
var _a;
|
|
147585
147673
|
if (isImportSpecifier(declaration)) {
|
|
147586
147674
|
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
147587
147675
|
declaration,
|
|
@@ -147652,6 +147740,16 @@ function doChange11(changes, sourceFile, declaration) {
|
|
|
147652
147740
|
)
|
|
147653
147741
|
]);
|
|
147654
147742
|
} else {
|
|
147743
|
+
const newNamedBindings = ((_a = importClause.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamedImports */ ? factory.updateNamedImports(
|
|
147744
|
+
importClause.namedBindings,
|
|
147745
|
+
sameMap(importClause.namedBindings.elements, (e) => factory.updateImportSpecifier(
|
|
147746
|
+
e,
|
|
147747
|
+
/*isTypeOnly*/
|
|
147748
|
+
false,
|
|
147749
|
+
e.propertyName,
|
|
147750
|
+
e.name
|
|
147751
|
+
))
|
|
147752
|
+
) : importClause.namedBindings;
|
|
147655
147753
|
const importDeclaration = factory.updateImportDeclaration(
|
|
147656
147754
|
declaration,
|
|
147657
147755
|
declaration.modifiers,
|
|
@@ -147660,7 +147758,7 @@ function doChange11(changes, sourceFile, declaration) {
|
|
|
147660
147758
|
/*isTypeOnly*/
|
|
147661
147759
|
true,
|
|
147662
147760
|
importClause.name,
|
|
147663
|
-
|
|
147761
|
+
newNamedBindings
|
|
147664
147762
|
),
|
|
147665
147763
|
declaration.moduleSpecifier,
|
|
147666
147764
|
declaration.assertClause
|
|
@@ -151349,7 +151447,7 @@ registerCodeFix({
|
|
|
151349
151447
|
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
151350
151448
|
}
|
|
151351
151449
|
if (typeOnlyChanges.length) {
|
|
151352
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.
|
|
151450
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Use_import_type));
|
|
151353
151451
|
}
|
|
151354
151452
|
return actions2;
|
|
151355
151453
|
},
|
|
@@ -159282,7 +159380,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
159282
159380
|
}
|
|
159283
159381
|
const keys = getOwnKeys(exports);
|
|
159284
159382
|
const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
|
|
159285
|
-
const conditions = mode === 99 /* ESNext */
|
|
159383
|
+
const conditions = getConditions(compilerOptions, mode === 99 /* ESNext */);
|
|
159286
159384
|
addCompletionEntriesFromPathsOrExports(
|
|
159287
159385
|
result,
|
|
159288
159386
|
fragmentSubpath,
|