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/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230602`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7300,8 +7300,6 @@ ${lanes.join("\n")}
|
|
|
7300
7300
|
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."),
|
|
7301
7301
|
Did_you_mean_0: diag(1369, 3 /* Message */, "Did_you_mean_0_1369", "Did you mean '{0}'?"),
|
|
7302
7302
|
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'."),
|
|
7303
|
-
Convert_to_type_only_import: diag(1373, 3 /* Message */, "Convert_to_type_only_import_1373", "Convert to type-only import"),
|
|
7304
|
-
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"),
|
|
7305
7303
|
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."),
|
|
7306
7304
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
7307
7305
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
@@ -8507,6 +8505,8 @@ ${lanes.join("\n")}
|
|
|
8507
8505
|
Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
|
|
8508
8506
|
Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
|
|
8509
8507
|
Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
|
|
8508
|
+
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}."),
|
|
8509
|
+
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}."),
|
|
8510
8510
|
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}'"),
|
|
8511
8511
|
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."),
|
|
8512
8512
|
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."),
|
|
@@ -9019,6 +9019,9 @@ ${lanes.join("\n")}
|
|
|
9019
9019
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
9020
9020
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
9021
9021
|
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"),
|
|
9022
|
+
Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
|
|
9023
|
+
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
9024
|
+
Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
|
|
9022
9025
|
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."),
|
|
9023
9026
|
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'."),
|
|
9024
9027
|
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?"),
|
|
@@ -40948,11 +40951,13 @@ ${lanes.join("\n")}
|
|
|
40948
40951
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
40949
40952
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
40950
40953
|
if (priorityExtensions) {
|
|
40954
|
+
traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0, formatExtensions(priorityExtensions));
|
|
40951
40955
|
const result = lookup(priorityExtensions);
|
|
40952
40956
|
if (result)
|
|
40953
40957
|
return result;
|
|
40954
40958
|
}
|
|
40955
40959
|
if (secondaryExtensions && !typesScopeOnly) {
|
|
40960
|
+
traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0, formatExtensions(secondaryExtensions));
|
|
40956
40961
|
return lookup(secondaryExtensions);
|
|
40957
40962
|
}
|
|
40958
40963
|
function lookup(extensions2) {
|
|
@@ -67155,6 +67160,8 @@ ${lanes.join("\n")}
|
|
|
67155
67160
|
}
|
|
67156
67161
|
function isConstantReference(node) {
|
|
67157
67162
|
switch (node.kind) {
|
|
67163
|
+
case 110 /* ThisKeyword */:
|
|
67164
|
+
return true;
|
|
67158
67165
|
case 80 /* Identifier */:
|
|
67159
67166
|
if (!isThisInTypeQuery(node)) {
|
|
67160
67167
|
const symbol = getResolvedSymbol(node);
|
|
@@ -90601,8 +90608,9 @@ ${lanes.join("\n")}
|
|
|
90601
90608
|
let pendingStatements;
|
|
90602
90609
|
let lexicalEnvironment;
|
|
90603
90610
|
const lexicalEnvironmentMap = /* @__PURE__ */ new Map();
|
|
90611
|
+
const noSubstitution = /* @__PURE__ */ new Set();
|
|
90604
90612
|
let currentClassContainer;
|
|
90605
|
-
let
|
|
90613
|
+
let currentClassElement;
|
|
90606
90614
|
let shouldSubstituteThisWithClassThis = false;
|
|
90607
90615
|
let previousShouldSubstituteThisWithClassThis = false;
|
|
90608
90616
|
return chainBundle(context, transformSourceFile);
|
|
@@ -90694,13 +90702,18 @@ ${lanes.join("\n")}
|
|
|
90694
90702
|
return visitForStatement(node);
|
|
90695
90703
|
case 261 /* FunctionDeclaration */:
|
|
90696
90704
|
case 217 /* FunctionExpression */:
|
|
90705
|
+
return setCurrentClassElementAnd(
|
|
90706
|
+
/*classElement*/
|
|
90707
|
+
void 0,
|
|
90708
|
+
fallbackVisitor,
|
|
90709
|
+
node
|
|
90710
|
+
);
|
|
90697
90711
|
case 175 /* Constructor */:
|
|
90698
90712
|
case 173 /* MethodDeclaration */:
|
|
90699
90713
|
case 176 /* GetAccessor */:
|
|
90700
90714
|
case 177 /* SetAccessor */: {
|
|
90701
|
-
return
|
|
90702
|
-
|
|
90703
|
-
void 0,
|
|
90715
|
+
return setCurrentClassElementAnd(
|
|
90716
|
+
node,
|
|
90704
90717
|
fallbackVisitor,
|
|
90705
90718
|
node
|
|
90706
90719
|
);
|
|
@@ -90789,25 +90802,31 @@ ${lanes.join("\n")}
|
|
|
90789
90802
|
function classElementVisitor(node) {
|
|
90790
90803
|
switch (node.kind) {
|
|
90791
90804
|
case 175 /* Constructor */:
|
|
90792
|
-
return
|
|
90805
|
+
return setCurrentClassElementAnd(
|
|
90806
|
+
node,
|
|
90807
|
+
visitConstructorDeclaration,
|
|
90808
|
+
node
|
|
90809
|
+
);
|
|
90793
90810
|
case 176 /* GetAccessor */:
|
|
90794
90811
|
case 177 /* SetAccessor */:
|
|
90795
90812
|
case 173 /* MethodDeclaration */:
|
|
90796
|
-
return
|
|
90797
|
-
|
|
90798
|
-
void 0,
|
|
90813
|
+
return setCurrentClassElementAnd(
|
|
90814
|
+
node,
|
|
90799
90815
|
visitMethodOrAccessorDeclaration,
|
|
90800
90816
|
node
|
|
90801
90817
|
);
|
|
90802
90818
|
case 171 /* PropertyDeclaration */:
|
|
90803
|
-
return
|
|
90804
|
-
|
|
90805
|
-
void 0,
|
|
90819
|
+
return setCurrentClassElementAnd(
|
|
90820
|
+
node,
|
|
90806
90821
|
visitPropertyDeclaration,
|
|
90807
90822
|
node
|
|
90808
90823
|
);
|
|
90809
90824
|
case 174 /* ClassStaticBlockDeclaration */:
|
|
90810
|
-
return
|
|
90825
|
+
return setCurrentClassElementAnd(
|
|
90826
|
+
node,
|
|
90827
|
+
visitClassStaticBlockDeclaration,
|
|
90828
|
+
node
|
|
90829
|
+
);
|
|
90811
90830
|
case 166 /* ComputedPropertyName */:
|
|
90812
90831
|
return visitComputedPropertyName(node);
|
|
90813
90832
|
case 239 /* SemicolonClassElement */:
|
|
@@ -91001,12 +91020,15 @@ ${lanes.join("\n")}
|
|
|
91001
91020
|
}
|
|
91002
91021
|
return void 0;
|
|
91003
91022
|
}
|
|
91004
|
-
function
|
|
91005
|
-
|
|
91006
|
-
|
|
91007
|
-
|
|
91008
|
-
|
|
91009
|
-
|
|
91023
|
+
function setCurrentClassElementAnd(classElement, visitor2, arg) {
|
|
91024
|
+
if (classElement !== currentClassElement) {
|
|
91025
|
+
const savedCurrentClassElement = currentClassElement;
|
|
91026
|
+
currentClassElement = classElement;
|
|
91027
|
+
const result = visitor2(arg);
|
|
91028
|
+
currentClassElement = savedCurrentClassElement;
|
|
91029
|
+
return result;
|
|
91030
|
+
}
|
|
91031
|
+
return visitor2(arg);
|
|
91010
91032
|
}
|
|
91011
91033
|
function getHoistedFunctionName(node) {
|
|
91012
91034
|
Debug.assert(isPrivateIdentifier(node.name));
|
|
@@ -91168,8 +91190,21 @@ ${lanes.join("\n")}
|
|
|
91168
91190
|
}
|
|
91169
91191
|
return transformFieldInitializer(node);
|
|
91170
91192
|
}
|
|
91193
|
+
function shouldForceDynamicThis() {
|
|
91194
|
+
return !!currentClassElement && hasStaticModifier(currentClassElement) && isAccessor(currentClassElement) && isAutoAccessorPropertyDeclaration(getOriginalNode(currentClassElement));
|
|
91195
|
+
}
|
|
91196
|
+
function ensureDynamicThisIfNeeded(node) {
|
|
91197
|
+
if (shouldForceDynamicThis()) {
|
|
91198
|
+
const innerExpression = skipOuterExpressions(node);
|
|
91199
|
+
if (innerExpression.kind === 110 /* ThisKeyword */) {
|
|
91200
|
+
noSubstitution.add(innerExpression);
|
|
91201
|
+
}
|
|
91202
|
+
}
|
|
91203
|
+
}
|
|
91171
91204
|
function createPrivateIdentifierAccess(info, receiver) {
|
|
91172
|
-
|
|
91205
|
+
receiver = visitNode(receiver, visitor, isExpression);
|
|
91206
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91207
|
+
return createPrivateIdentifierAccessHelper(info, receiver);
|
|
91173
91208
|
}
|
|
91174
91209
|
function createPrivateIdentifierAccessHelper(info, receiver) {
|
|
91175
91210
|
setCommentRange(receiver, moveRangePos(receiver, -1));
|
|
@@ -91214,7 +91249,7 @@ ${lanes.join("\n")}
|
|
|
91214
91249
|
);
|
|
91215
91250
|
}
|
|
91216
91251
|
}
|
|
91217
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && isIdentifier(node.name) &&
|
|
91252
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91218
91253
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91219
91254
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91220
91255
|
return visitInvalidSuperProperty(node);
|
|
@@ -91233,7 +91268,7 @@ ${lanes.join("\n")}
|
|
|
91233
91268
|
return visitEachChild(node, visitor, context);
|
|
91234
91269
|
}
|
|
91235
91270
|
function visitElementAccessExpression(node) {
|
|
91236
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
91271
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91237
91272
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91238
91273
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91239
91274
|
return visitInvalidSuperProperty(node);
|
|
@@ -91258,6 +91293,7 @@ ${lanes.join("\n")}
|
|
|
91258
91293
|
let info;
|
|
91259
91294
|
if (info = accessPrivateIdentifier2(operand.name)) {
|
|
91260
91295
|
const receiver = visitNode(operand.expression, visitor, isExpression);
|
|
91296
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91261
91297
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
91262
91298
|
let expression = createPrivateIdentifierAccess(info, readExpression);
|
|
91263
91299
|
const temp = isPrefixUnaryExpression(node) || discarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration);
|
|
@@ -91276,7 +91312,7 @@ ${lanes.join("\n")}
|
|
|
91276
91312
|
}
|
|
91277
91313
|
return expression;
|
|
91278
91314
|
}
|
|
91279
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(operand) &&
|
|
91315
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(operand) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91280
91316
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91281
91317
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91282
91318
|
const expression = visitInvalidSuperProperty(operand);
|
|
@@ -91333,6 +91369,9 @@ ${lanes.join("\n")}
|
|
|
91333
91369
|
}
|
|
91334
91370
|
function createCopiableReceiverExpr(receiver) {
|
|
91335
91371
|
const clone2 = nodeIsSynthesized(receiver) ? receiver : factory2.cloneNode(receiver);
|
|
91372
|
+
if (receiver.kind === 110 /* ThisKeyword */ && noSubstitution.has(receiver)) {
|
|
91373
|
+
noSubstitution.add(clone2);
|
|
91374
|
+
}
|
|
91336
91375
|
if (isSimpleInlineableExpression(receiver)) {
|
|
91337
91376
|
return { readExpression: clone2, initializeExpression: void 0 };
|
|
91338
91377
|
}
|
|
@@ -91363,7 +91402,7 @@ ${lanes.join("\n")}
|
|
|
91363
91402
|
[visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)]
|
|
91364
91403
|
);
|
|
91365
91404
|
}
|
|
91366
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) &&
|
|
91405
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.expression) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
91367
91406
|
const invocation = factory2.createFunctionCallCall(
|
|
91368
91407
|
visitNode(node.expression, visitor, isExpression),
|
|
91369
91408
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -91392,7 +91431,7 @@ ${lanes.join("\n")}
|
|
|
91392
91431
|
visitNode(node.template, visitor, isTemplateLiteral)
|
|
91393
91432
|
);
|
|
91394
91433
|
}
|
|
91395
|
-
if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) &&
|
|
91434
|
+
if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.tag) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) {
|
|
91396
91435
|
const invocation = factory2.createFunctionBindCall(
|
|
91397
91436
|
visitNode(node.tag, visitor, isExpression),
|
|
91398
91437
|
lexicalEnvironment.data.classConstructor,
|
|
@@ -91416,7 +91455,7 @@ ${lanes.join("\n")}
|
|
|
91416
91455
|
}
|
|
91417
91456
|
if (shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
91418
91457
|
startLexicalEnvironment();
|
|
91419
|
-
let statements =
|
|
91458
|
+
let statements = setCurrentClassElementAnd(
|
|
91420
91459
|
node,
|
|
91421
91460
|
(statements2) => visitNodes2(statements2, visitor, isStatement),
|
|
91422
91461
|
node.body.statements
|
|
@@ -91478,7 +91517,7 @@ ${lanes.join("\n")}
|
|
|
91478
91517
|
node
|
|
91479
91518
|
);
|
|
91480
91519
|
}
|
|
91481
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.left) &&
|
|
91520
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.left) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
91482
91521
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
91483
91522
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
91484
91523
|
return factory2.updateBinaryExpression(
|
|
@@ -91573,6 +91612,7 @@ ${lanes.join("\n")}
|
|
|
91573
91612
|
function createPrivateIdentifierAssignment(info, receiver, right, operator) {
|
|
91574
91613
|
receiver = visitNode(receiver, visitor, isExpression);
|
|
91575
91614
|
right = visitNode(right, visitor, isExpression);
|
|
91615
|
+
ensureDynamicThisIfNeeded(receiver);
|
|
91576
91616
|
if (isCompoundAssignment(operator)) {
|
|
91577
91617
|
const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
|
|
91578
91618
|
receiver = initializeExpression || readExpression;
|
|
@@ -92215,7 +92255,7 @@ ${lanes.join("\n")}
|
|
|
92215
92255
|
}
|
|
92216
92256
|
function transformProperty(property, receiver) {
|
|
92217
92257
|
var _a;
|
|
92218
|
-
const
|
|
92258
|
+
const savedCurrentClassElement = currentClassElement;
|
|
92219
92259
|
const transformed = transformPropertyWorker(property, receiver);
|
|
92220
92260
|
if (transformed && hasStaticModifier(property) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts)) {
|
|
92221
92261
|
setOriginalNode(transformed, property);
|
|
@@ -92223,7 +92263,7 @@ ${lanes.join("\n")}
|
|
|
92223
92263
|
setSourceMapRange(transformed, getSourceMapRange(property.name));
|
|
92224
92264
|
lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment);
|
|
92225
92265
|
}
|
|
92226
|
-
|
|
92266
|
+
currentClassElement = savedCurrentClassElement;
|
|
92227
92267
|
return transformed;
|
|
92228
92268
|
}
|
|
92229
92269
|
function transformPropertyWorker(property, receiver) {
|
|
@@ -92240,7 +92280,7 @@ ${lanes.join("\n")}
|
|
|
92240
92280
|
}
|
|
92241
92281
|
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;
|
|
92242
92282
|
if (hasStaticModifier(property)) {
|
|
92243
|
-
|
|
92283
|
+
currentClassElement = property;
|
|
92244
92284
|
}
|
|
92245
92285
|
const initializerVisitor = referencedName ? (child) => namedEvaluationVisitor(child, referencedName) : visitor;
|
|
92246
92286
|
if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property)) {
|
|
@@ -92565,7 +92605,7 @@ ${lanes.join("\n")}
|
|
|
92565
92605
|
}
|
|
92566
92606
|
if (isPrivateIdentifierPropertyAccessExpression(node)) {
|
|
92567
92607
|
return wrapPrivateIdentifierForDestructuringTarget(node);
|
|
92568
|
-
} else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) &&
|
|
92608
|
+
} else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
92569
92609
|
const { classConstructor, superClassReference, facts } = lexicalEnvironment.data;
|
|
92570
92610
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
92571
92611
|
return visitInvalidSuperProperty(node);
|
|
@@ -92745,7 +92785,7 @@ ${lanes.join("\n")}
|
|
|
92745
92785
|
return node;
|
|
92746
92786
|
}
|
|
92747
92787
|
function substituteThisExpression(node) {
|
|
92748
|
-
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) {
|
|
92788
|
+
if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) && !noSubstitution.has(node)) {
|
|
92749
92789
|
const { facts, classConstructor, classThis } = lexicalEnvironment.data;
|
|
92750
92790
|
if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) {
|
|
92751
92791
|
return factory2.createParenthesizedExpression(factory2.createVoidZero());
|
|
@@ -92814,6 +92854,12 @@ ${lanes.join("\n")}
|
|
|
92814
92854
|
function isPrivateIdentifierInExpression(node) {
|
|
92815
92855
|
return isPrivateIdentifier(node.left) && node.operatorToken.kind === 103 /* InKeyword */;
|
|
92816
92856
|
}
|
|
92857
|
+
function isStaticPropertyDeclaration2(node) {
|
|
92858
|
+
return isPropertyDeclaration(node) && hasStaticModifier(node);
|
|
92859
|
+
}
|
|
92860
|
+
function isStaticPropertyDeclarationOrClassStaticBlock(node) {
|
|
92861
|
+
return isClassStaticBlockDeclaration(node) || isStaticPropertyDeclaration2(node);
|
|
92862
|
+
}
|
|
92817
92863
|
var init_classFields = __esm({
|
|
92818
92864
|
"src/compiler/transformers/classFields.ts"() {
|
|
92819
92865
|
"use strict";
|
|
@@ -98208,7 +98254,7 @@ ${lanes.join("\n")}
|
|
|
98208
98254
|
continue;
|
|
98209
98255
|
}
|
|
98210
98256
|
finishObjectLiteralIfNeeded();
|
|
98211
|
-
expressions.push(attr.expression);
|
|
98257
|
+
expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression)));
|
|
98212
98258
|
continue;
|
|
98213
98259
|
}
|
|
98214
98260
|
properties.push(transformJsxAttributeToObjectLiteralElement(attr));
|
|
@@ -146306,7 +146352,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
146306
146352
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
146307
146353
|
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
146308
146354
|
}
|
|
146355
|
+
function canConvertImportDeclarationForSpecifier(specifier, sourceFile, program) {
|
|
146356
|
+
if (specifier.parent.parent.name) {
|
|
146357
|
+
return false;
|
|
146358
|
+
}
|
|
146359
|
+
const nonTypeOnlySpecifiers = specifier.parent.elements.filter((e) => !e.isTypeOnly);
|
|
146360
|
+
if (nonTypeOnlySpecifiers.length === 1) {
|
|
146361
|
+
return true;
|
|
146362
|
+
}
|
|
146363
|
+
const checker = program.getTypeChecker();
|
|
146364
|
+
for (const specifier2 of nonTypeOnlySpecifiers) {
|
|
146365
|
+
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage) => {
|
|
146366
|
+
return !isValidTypeOnlyAliasUseSite(usage);
|
|
146367
|
+
});
|
|
146368
|
+
if (isUsedAsValue) {
|
|
146369
|
+
return false;
|
|
146370
|
+
}
|
|
146371
|
+
}
|
|
146372
|
+
return true;
|
|
146373
|
+
}
|
|
146309
146374
|
function doChange11(changes, sourceFile, declaration) {
|
|
146375
|
+
var _a;
|
|
146310
146376
|
if (isImportSpecifier(declaration)) {
|
|
146311
146377
|
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
146312
146378
|
declaration,
|
|
@@ -146377,6 +146443,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
146377
146443
|
)
|
|
146378
146444
|
]);
|
|
146379
146445
|
} else {
|
|
146446
|
+
const newNamedBindings = ((_a = importClause.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamedImports */ ? factory.updateNamedImports(
|
|
146447
|
+
importClause.namedBindings,
|
|
146448
|
+
sameMap(importClause.namedBindings.elements, (e) => factory.updateImportSpecifier(
|
|
146449
|
+
e,
|
|
146450
|
+
/*isTypeOnly*/
|
|
146451
|
+
false,
|
|
146452
|
+
e.propertyName,
|
|
146453
|
+
e.name
|
|
146454
|
+
))
|
|
146455
|
+
) : importClause.namedBindings;
|
|
146380
146456
|
const importDeclaration = factory.updateImportDeclaration(
|
|
146381
146457
|
declaration,
|
|
146382
146458
|
declaration.modifiers,
|
|
@@ -146385,7 +146461,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
146385
146461
|
/*isTypeOnly*/
|
|
146386
146462
|
true,
|
|
146387
146463
|
importClause.name,
|
|
146388
|
-
|
|
146464
|
+
newNamedBindings
|
|
146389
146465
|
),
|
|
146390
146466
|
declaration.moduleSpecifier,
|
|
146391
146467
|
declaration.assertClause
|
|
@@ -146408,19 +146484,41 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
146408
146484
|
registerCodeFix({
|
|
146409
146485
|
errorCodes: errorCodes14,
|
|
146410
146486
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
146487
|
+
var _a;
|
|
146411
146488
|
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
146412
146489
|
if (declaration) {
|
|
146413
146490
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
|
|
146414
|
-
|
|
146491
|
+
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;
|
|
146492
|
+
const mainAction = createCodeFixAction(
|
|
146493
|
+
fixId13,
|
|
146494
|
+
changes,
|
|
146495
|
+
declaration.kind === 275 /* ImportSpecifier */ ? [Diagnostics.Use_type_0, ((_a = declaration.propertyName) == null ? void 0 : _a.text) ?? declaration.name.text] : Diagnostics.Use_import_type,
|
|
146496
|
+
fixId13,
|
|
146497
|
+
Diagnostics.Fix_all_with_type_only_imports
|
|
146498
|
+
);
|
|
146499
|
+
if (some(importDeclarationChanges)) {
|
|
146500
|
+
return [
|
|
146501
|
+
createCodeFixActionWithoutFixAll(fixId13, importDeclarationChanges, Diagnostics.Use_import_type),
|
|
146502
|
+
mainAction
|
|
146503
|
+
];
|
|
146504
|
+
}
|
|
146505
|
+
return [mainAction];
|
|
146415
146506
|
}
|
|
146416
146507
|
return void 0;
|
|
146417
146508
|
},
|
|
146418
146509
|
fixIds: [fixId13],
|
|
146419
146510
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
146511
|
+
const fixedImportDeclarations = /* @__PURE__ */ new Set();
|
|
146420
146512
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
146421
|
-
const
|
|
146422
|
-
if (
|
|
146423
|
-
doChange11(changes, diag2.file,
|
|
146513
|
+
const errorDeclaration = getDeclaration2(diag2.file, diag2.start);
|
|
146514
|
+
if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 271 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
|
|
146515
|
+
doChange11(changes, diag2.file, errorDeclaration);
|
|
146516
|
+
fixedImportDeclarations.add(errorDeclaration);
|
|
146517
|
+
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
|
|
146518
|
+
doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
|
|
146519
|
+
fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
|
|
146520
|
+
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */) {
|
|
146521
|
+
doChange11(changes, diag2.file, errorDeclaration);
|
|
146424
146522
|
}
|
|
146425
146523
|
});
|
|
146426
146524
|
}
|
|
@@ -150350,7 +150448,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150350
150448
|
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
150351
150449
|
}
|
|
150352
150450
|
if (typeOnlyChanges.length) {
|
|
150353
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.
|
|
150451
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Use_import_type));
|
|
150354
150452
|
}
|
|
150355
150453
|
return actions2;
|
|
150356
150454
|
},
|
|
@@ -158557,7 +158655,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158557
158655
|
}
|
|
158558
158656
|
const keys = getOwnKeys(exports);
|
|
158559
158657
|
const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
|
|
158560
|
-
const conditions = mode === 99 /* ESNext */
|
|
158658
|
+
const conditions = getConditions(compilerOptions, mode === 99 /* ESNext */);
|
|
158561
158659
|
addCompletionEntriesFromPathsOrExports(
|
|
158562
158660
|
result,
|
|
158563
158661
|
fragmentSubpath,
|