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/typescript.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));
|
|
@@ -146321,7 +146367,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
146321
146367
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
146322
146368
|
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
146323
146369
|
}
|
|
146370
|
+
function canConvertImportDeclarationForSpecifier(specifier, sourceFile, program) {
|
|
146371
|
+
if (specifier.parent.parent.name) {
|
|
146372
|
+
return false;
|
|
146373
|
+
}
|
|
146374
|
+
const nonTypeOnlySpecifiers = specifier.parent.elements.filter((e) => !e.isTypeOnly);
|
|
146375
|
+
if (nonTypeOnlySpecifiers.length === 1) {
|
|
146376
|
+
return true;
|
|
146377
|
+
}
|
|
146378
|
+
const checker = program.getTypeChecker();
|
|
146379
|
+
for (const specifier2 of nonTypeOnlySpecifiers) {
|
|
146380
|
+
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage) => {
|
|
146381
|
+
return !isValidTypeOnlyAliasUseSite(usage);
|
|
146382
|
+
});
|
|
146383
|
+
if (isUsedAsValue) {
|
|
146384
|
+
return false;
|
|
146385
|
+
}
|
|
146386
|
+
}
|
|
146387
|
+
return true;
|
|
146388
|
+
}
|
|
146324
146389
|
function doChange11(changes, sourceFile, declaration) {
|
|
146390
|
+
var _a;
|
|
146325
146391
|
if (isImportSpecifier(declaration)) {
|
|
146326
146392
|
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
146327
146393
|
declaration,
|
|
@@ -146392,6 +146458,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
146392
146458
|
)
|
|
146393
146459
|
]);
|
|
146394
146460
|
} else {
|
|
146461
|
+
const newNamedBindings = ((_a = importClause.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamedImports */ ? factory.updateNamedImports(
|
|
146462
|
+
importClause.namedBindings,
|
|
146463
|
+
sameMap(importClause.namedBindings.elements, (e) => factory.updateImportSpecifier(
|
|
146464
|
+
e,
|
|
146465
|
+
/*isTypeOnly*/
|
|
146466
|
+
false,
|
|
146467
|
+
e.propertyName,
|
|
146468
|
+
e.name
|
|
146469
|
+
))
|
|
146470
|
+
) : importClause.namedBindings;
|
|
146395
146471
|
const importDeclaration = factory.updateImportDeclaration(
|
|
146396
146472
|
declaration,
|
|
146397
146473
|
declaration.modifiers,
|
|
@@ -146400,7 +146476,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
146400
146476
|
/*isTypeOnly*/
|
|
146401
146477
|
true,
|
|
146402
146478
|
importClause.name,
|
|
146403
|
-
|
|
146479
|
+
newNamedBindings
|
|
146404
146480
|
),
|
|
146405
146481
|
declaration.moduleSpecifier,
|
|
146406
146482
|
declaration.assertClause
|
|
@@ -146423,19 +146499,41 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
146423
146499
|
registerCodeFix({
|
|
146424
146500
|
errorCodes: errorCodes14,
|
|
146425
146501
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
146502
|
+
var _a;
|
|
146426
146503
|
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
146427
146504
|
if (declaration) {
|
|
146428
146505
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
|
|
146429
|
-
|
|
146506
|
+
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;
|
|
146507
|
+
const mainAction = createCodeFixAction(
|
|
146508
|
+
fixId13,
|
|
146509
|
+
changes,
|
|
146510
|
+
declaration.kind === 275 /* ImportSpecifier */ ? [Diagnostics.Use_type_0, ((_a = declaration.propertyName) == null ? void 0 : _a.text) ?? declaration.name.text] : Diagnostics.Use_import_type,
|
|
146511
|
+
fixId13,
|
|
146512
|
+
Diagnostics.Fix_all_with_type_only_imports
|
|
146513
|
+
);
|
|
146514
|
+
if (some(importDeclarationChanges)) {
|
|
146515
|
+
return [
|
|
146516
|
+
createCodeFixActionWithoutFixAll(fixId13, importDeclarationChanges, Diagnostics.Use_import_type),
|
|
146517
|
+
mainAction
|
|
146518
|
+
];
|
|
146519
|
+
}
|
|
146520
|
+
return [mainAction];
|
|
146430
146521
|
}
|
|
146431
146522
|
return void 0;
|
|
146432
146523
|
},
|
|
146433
146524
|
fixIds: [fixId13],
|
|
146434
146525
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
146526
|
+
const fixedImportDeclarations = /* @__PURE__ */ new Set();
|
|
146435
146527
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
146436
|
-
const
|
|
146437
|
-
if (
|
|
146438
|
-
doChange11(changes, diag2.file,
|
|
146528
|
+
const errorDeclaration = getDeclaration2(diag2.file, diag2.start);
|
|
146529
|
+
if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 271 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
|
|
146530
|
+
doChange11(changes, diag2.file, errorDeclaration);
|
|
146531
|
+
fixedImportDeclarations.add(errorDeclaration);
|
|
146532
|
+
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
|
|
146533
|
+
doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
|
|
146534
|
+
fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
|
|
146535
|
+
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 275 /* ImportSpecifier */) {
|
|
146536
|
+
doChange11(changes, diag2.file, errorDeclaration);
|
|
146439
146537
|
}
|
|
146440
146538
|
});
|
|
146441
146539
|
}
|
|
@@ -150365,7 +150463,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150365
150463
|
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
150366
150464
|
}
|
|
150367
150465
|
if (typeOnlyChanges.length) {
|
|
150368
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.
|
|
150466
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Use_import_type));
|
|
150369
150467
|
}
|
|
150370
150468
|
return actions2;
|
|
150371
150469
|
},
|
|
@@ -158572,7 +158670,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158572
158670
|
}
|
|
158573
158671
|
const keys = getOwnKeys(exports);
|
|
158574
158672
|
const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
|
|
158575
|
-
const conditions = mode === 99 /* ESNext */
|
|
158673
|
+
const conditions = getConditions(compilerOptions, mode === 99 /* ESNext */);
|
|
158576
158674
|
addCompletionEntriesFromPathsOrExports(
|
|
158577
158675
|
result,
|
|
158578
158676
|
fragmentSubpath,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230602`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -5360,8 +5360,6 @@ var Diagnostics = {
|
|
|
5360
5360
|
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."),
|
|
5361
5361
|
Did_you_mean_0: diag(1369, 3 /* Message */, "Did_you_mean_0_1369", "Did you mean '{0}'?"),
|
|
5362
5362
|
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'."),
|
|
5363
|
-
Convert_to_type_only_import: diag(1373, 3 /* Message */, "Convert_to_type_only_import_1373", "Convert to type-only import"),
|
|
5364
|
-
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"),
|
|
5365
5363
|
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."),
|
|
5366
5364
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
5367
5365
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
@@ -6567,6 +6565,8 @@ var Diagnostics = {
|
|
|
6567
6565
|
Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
|
|
6568
6566
|
Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
|
|
6569
6567
|
Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
|
|
6568
|
+
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}."),
|
|
6569
|
+
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}."),
|
|
6570
6570
|
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}'"),
|
|
6571
6571
|
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."),
|
|
6572
6572
|
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."),
|
|
@@ -7079,6 +7079,9 @@ var Diagnostics = {
|
|
|
7079
7079
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
7080
7080
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
7081
7081
|
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"),
|
|
7082
|
+
Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"),
|
|
7083
|
+
Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
|
|
7084
|
+
Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
|
|
7082
7085
|
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."),
|
|
7083
7086
|
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'."),
|
|
7084
7087
|
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?"),
|
|
@@ -28534,11 +28537,13 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
|
|
|
28534
28537
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
28535
28538
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
28536
28539
|
if (priorityExtensions) {
|
|
28540
|
+
traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0, formatExtensions(priorityExtensions));
|
|
28537
28541
|
const result = lookup(priorityExtensions);
|
|
28538
28542
|
if (result)
|
|
28539
28543
|
return result;
|
|
28540
28544
|
}
|
|
28541
28545
|
if (secondaryExtensions && !typesScopeOnly) {
|
|
28546
|
+
traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0, formatExtensions(secondaryExtensions));
|
|
28542
28547
|
return lookup(secondaryExtensions);
|
|
28543
28548
|
}
|
|
28544
28549
|
function lookup(extensions2) {
|
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.2.0-dev.
|
|
5
|
+
"version": "5.2.0-dev.20230602",
|
|
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": "
|
|
116
|
+
"gitHead": "5bf1bac6f31c568fbc45be5414c759959d4ce0bf"
|
|
117
117
|
}
|