typescript 5.1.0-dev.20230427 → 5.1.0-dev.20230429
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 +261 -29
- package/lib/tsserver.js +262 -30
- package/lib/tsserverlibrary.d.ts +2 -2
- package/lib/tsserverlibrary.js +262 -30
- package/lib/typescript.d.ts +2 -2
- package/lib/typescript.js +261 -29
- package/lib/typingsInstaller.js +4 -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.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230429`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -15388,6 +15388,7 @@ ${lanes.join("\n")}
|
|
|
15388
15388
|
case 171 /* PropertyDeclaration */:
|
|
15389
15389
|
case 170 /* PropertySignature */:
|
|
15390
15390
|
case 252 /* ReturnStatement */:
|
|
15391
|
+
case 239 /* SemicolonClassElement */:
|
|
15391
15392
|
case 177 /* SetAccessor */:
|
|
15392
15393
|
case 303 /* ShorthandPropertyAssignment */:
|
|
15393
15394
|
case 304 /* SpreadAssignment */:
|
|
@@ -33583,11 +33584,11 @@ ${lanes.join("\n")}
|
|
|
33583
33584
|
}
|
|
33584
33585
|
function parseClassElement() {
|
|
33585
33586
|
const pos = getNodePos();
|
|
33587
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
33586
33588
|
if (token() === 27 /* SemicolonToken */) {
|
|
33587
33589
|
nextToken();
|
|
33588
|
-
return finishNode(factory2.createSemicolonClassElement(), pos);
|
|
33590
|
+
return withJSDoc(finishNode(factory2.createSemicolonClassElement(), pos), hasJSDoc);
|
|
33589
33591
|
}
|
|
33590
|
-
const hasJSDoc = hasPrecedingJSDocComment();
|
|
33591
33592
|
const modifiers = parseModifiers(
|
|
33592
33593
|
/*allowDecorators*/
|
|
33593
33594
|
true,
|
|
@@ -46083,13 +46084,14 @@ ${lanes.join("\n")}
|
|
|
46083
46084
|
return diagnostic;
|
|
46084
46085
|
}
|
|
46085
46086
|
function isDeprecatedSymbol(symbol) {
|
|
46086
|
-
|
|
46087
|
-
|
|
46088
|
-
|
|
46089
|
-
return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
|
|
46090
|
-
}
|
|
46087
|
+
const parentSymbol = getParentOfSymbol(symbol);
|
|
46088
|
+
if (parentSymbol && length(symbol.declarations) > 1) {
|
|
46089
|
+
return parentSymbol.flags & 64 /* Interface */ ? some(symbol.declarations, isDeprecatedDeclaration2) : every(symbol.declarations, isDeprecatedDeclaration2);
|
|
46091
46090
|
}
|
|
46092
|
-
return !!(
|
|
46091
|
+
return !!symbol.valueDeclaration && isDeprecatedDeclaration2(symbol.valueDeclaration) || length(symbol.declarations) && every(symbol.declarations, isDeprecatedDeclaration2);
|
|
46092
|
+
}
|
|
46093
|
+
function isDeprecatedDeclaration2(declaration) {
|
|
46094
|
+
return !!(getCombinedNodeFlags(declaration) & 268435456 /* Deprecated */);
|
|
46093
46095
|
}
|
|
46094
46096
|
function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
|
|
46095
46097
|
const diagnostic = createDiagnosticForNode(location, Diagnostics._0_is_deprecated, deprecatedEntity);
|
|
@@ -68249,7 +68251,7 @@ ${lanes.join("\n")}
|
|
|
68249
68251
|
markAliasReferenced(symbol, node);
|
|
68250
68252
|
}
|
|
68251
68253
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
68252
|
-
const targetSymbol =
|
|
68254
|
+
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
68253
68255
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
68254
68256
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
68255
68257
|
}
|
|
@@ -71253,8 +71255,9 @@ ${lanes.join("\n")}
|
|
|
71253
71255
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
71254
71256
|
}
|
|
71255
71257
|
} else {
|
|
71256
|
-
|
|
71257
|
-
|
|
71258
|
+
const targetPropSymbol = resolveAliasWithDeprecationCheck(prop, right);
|
|
71259
|
+
if (isDeprecatedSymbol(targetPropSymbol) && isUncalledFunctionReference(node, targetPropSymbol) && targetPropSymbol.declarations) {
|
|
71260
|
+
addDeprecatedSuggestion(right, targetPropSymbol.declarations, right.escapedText);
|
|
71258
71261
|
}
|
|
71259
71262
|
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
|
|
71260
71263
|
markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
|
|
@@ -81530,19 +81533,17 @@ ${lanes.join("\n")}
|
|
|
81530
81533
|
}
|
|
81531
81534
|
}
|
|
81532
81535
|
if (isImportSpecifier(node)) {
|
|
81533
|
-
const targetSymbol =
|
|
81534
|
-
if (
|
|
81536
|
+
const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
|
|
81537
|
+
if (isDeprecatedSymbol(targetSymbol) && targetSymbol.declarations) {
|
|
81535
81538
|
addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
|
|
81536
81539
|
}
|
|
81537
81540
|
}
|
|
81538
81541
|
}
|
|
81539
81542
|
}
|
|
81540
|
-
function
|
|
81541
|
-
|
|
81542
|
-
}
|
|
81543
|
-
function checkDeprecatedAliasedSymbol(symbol, location) {
|
|
81544
|
-
if (!(symbol.flags & 2097152 /* Alias */))
|
|
81543
|
+
function resolveAliasWithDeprecationCheck(symbol, location) {
|
|
81544
|
+
if (!(symbol.flags & 2097152 /* Alias */) || isDeprecatedSymbol(symbol) || !getDeclarationOfAliasSymbol(symbol)) {
|
|
81545
81545
|
return symbol;
|
|
81546
|
+
}
|
|
81546
81547
|
const targetSymbol = resolveAlias(symbol);
|
|
81547
81548
|
if (targetSymbol === unknownSymbol)
|
|
81548
81549
|
return targetSymbol;
|
|
@@ -81552,7 +81553,7 @@ ${lanes.join("\n")}
|
|
|
81552
81553
|
if (target === targetSymbol)
|
|
81553
81554
|
break;
|
|
81554
81555
|
if (target.declarations && length(target.declarations)) {
|
|
81555
|
-
if (
|
|
81556
|
+
if (isDeprecatedSymbol(target)) {
|
|
81556
81557
|
addDeprecatedSuggestion(location, target.declarations, target.escapedName);
|
|
81557
81558
|
break;
|
|
81558
81559
|
} else {
|
|
@@ -93213,6 +93214,19 @@ ${lanes.join("\n")}
|
|
|
93213
93214
|
let members = visitNodes2(node.members, visitor, isClassElement);
|
|
93214
93215
|
let decorationStatements = [];
|
|
93215
93216
|
({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
|
|
93217
|
+
const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member, 32 /* Static */) || isClassStaticBlockDeclaration(member));
|
|
93218
|
+
if (assignClassAliasInStaticBlock) {
|
|
93219
|
+
members = setTextRange(factory2.createNodeArray([
|
|
93220
|
+
factory2.createClassStaticBlockDeclaration(
|
|
93221
|
+
factory2.createBlock([
|
|
93222
|
+
factory2.createExpressionStatement(
|
|
93223
|
+
factory2.createAssignment(classAlias, factory2.createThis())
|
|
93224
|
+
)
|
|
93225
|
+
])
|
|
93226
|
+
),
|
|
93227
|
+
...members
|
|
93228
|
+
]), members);
|
|
93229
|
+
}
|
|
93216
93230
|
const classExpression = factory2.createClassExpression(
|
|
93217
93231
|
modifiers,
|
|
93218
93232
|
name && isGeneratedIdentifier(name) ? void 0 : name,
|
|
@@ -93229,7 +93243,7 @@ ${lanes.join("\n")}
|
|
|
93229
93243
|
void 0,
|
|
93230
93244
|
/*type*/
|
|
93231
93245
|
void 0,
|
|
93232
|
-
classAlias ? factory2.createAssignment(classAlias, classExpression) : classExpression
|
|
93246
|
+
classAlias && !assignClassAliasInStaticBlock ? factory2.createAssignment(classAlias, classExpression) : classExpression
|
|
93233
93247
|
);
|
|
93234
93248
|
setOriginalNode(varDecl, node);
|
|
93235
93249
|
let varModifiers;
|
|
@@ -104291,12 +104305,56 @@ ${lanes.join("\n")}
|
|
|
104291
104305
|
return visitExportDeclaration(node);
|
|
104292
104306
|
case 276 /* ExportAssignment */:
|
|
104293
104307
|
return visitExportAssignment(node);
|
|
104308
|
+
case 261 /* FunctionDeclaration */:
|
|
104309
|
+
return visitFunctionDeclaration(node);
|
|
104310
|
+
case 262 /* ClassDeclaration */:
|
|
104311
|
+
return visitClassDeclaration(node);
|
|
104312
|
+
default:
|
|
104313
|
+
return topLevelNestedVisitor(node);
|
|
104314
|
+
}
|
|
104315
|
+
}
|
|
104316
|
+
function topLevelNestedVisitor(node) {
|
|
104317
|
+
switch (node.kind) {
|
|
104294
104318
|
case 242 /* VariableStatement */:
|
|
104295
104319
|
return visitVariableStatement(node);
|
|
104296
104320
|
case 261 /* FunctionDeclaration */:
|
|
104297
104321
|
return visitFunctionDeclaration(node);
|
|
104298
104322
|
case 262 /* ClassDeclaration */:
|
|
104299
104323
|
return visitClassDeclaration(node);
|
|
104324
|
+
case 247 /* ForStatement */:
|
|
104325
|
+
return visitForStatement(
|
|
104326
|
+
node,
|
|
104327
|
+
/*isTopLevel*/
|
|
104328
|
+
true
|
|
104329
|
+
);
|
|
104330
|
+
case 248 /* ForInStatement */:
|
|
104331
|
+
return visitForInStatement(node);
|
|
104332
|
+
case 249 /* ForOfStatement */:
|
|
104333
|
+
return visitForOfStatement(node);
|
|
104334
|
+
case 245 /* DoStatement */:
|
|
104335
|
+
return visitDoStatement(node);
|
|
104336
|
+
case 246 /* WhileStatement */:
|
|
104337
|
+
return visitWhileStatement(node);
|
|
104338
|
+
case 255 /* LabeledStatement */:
|
|
104339
|
+
return visitLabeledStatement(node);
|
|
104340
|
+
case 253 /* WithStatement */:
|
|
104341
|
+
return visitWithStatement(node);
|
|
104342
|
+
case 244 /* IfStatement */:
|
|
104343
|
+
return visitIfStatement(node);
|
|
104344
|
+
case 254 /* SwitchStatement */:
|
|
104345
|
+
return visitSwitchStatement(node);
|
|
104346
|
+
case 268 /* CaseBlock */:
|
|
104347
|
+
return visitCaseBlock(node);
|
|
104348
|
+
case 295 /* CaseClause */:
|
|
104349
|
+
return visitCaseClause(node);
|
|
104350
|
+
case 296 /* DefaultClause */:
|
|
104351
|
+
return visitDefaultClause(node);
|
|
104352
|
+
case 257 /* TryStatement */:
|
|
104353
|
+
return visitTryStatement(node);
|
|
104354
|
+
case 298 /* CatchClause */:
|
|
104355
|
+
return visitCatchClause(node);
|
|
104356
|
+
case 240 /* Block */:
|
|
104357
|
+
return visitBlock(node);
|
|
104300
104358
|
default:
|
|
104301
104359
|
return visitor(node);
|
|
104302
104360
|
}
|
|
@@ -104307,7 +104365,11 @@ ${lanes.join("\n")}
|
|
|
104307
104365
|
}
|
|
104308
104366
|
switch (node.kind) {
|
|
104309
104367
|
case 247 /* ForStatement */:
|
|
104310
|
-
return visitForStatement(
|
|
104368
|
+
return visitForStatement(
|
|
104369
|
+
node,
|
|
104370
|
+
/*isTopLevel*/
|
|
104371
|
+
false
|
|
104372
|
+
);
|
|
104311
104373
|
case 243 /* ExpressionStatement */:
|
|
104312
104374
|
return visitExpressionStatement(node);
|
|
104313
104375
|
case 216 /* ParenthesizedExpression */:
|
|
@@ -104392,15 +104454,177 @@ ${lanes.join("\n")}
|
|
|
104392
104454
|
}
|
|
104393
104455
|
return visitEachChild(node, visitor, context);
|
|
104394
104456
|
}
|
|
104395
|
-
function visitForStatement(node) {
|
|
104457
|
+
function visitForStatement(node, isTopLevel) {
|
|
104458
|
+
if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
104459
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
104460
|
+
/*statements*/
|
|
104461
|
+
void 0,
|
|
104462
|
+
node.initializer,
|
|
104463
|
+
/*isForInOrOfInitializer*/
|
|
104464
|
+
false
|
|
104465
|
+
);
|
|
104466
|
+
if (exportStatements) {
|
|
104467
|
+
const statements = [];
|
|
104468
|
+
const varDeclList = visitNode(node.initializer, discardedValueVisitor, isVariableDeclarationList);
|
|
104469
|
+
const varStatement = factory2.createVariableStatement(
|
|
104470
|
+
/*modifiers*/
|
|
104471
|
+
void 0,
|
|
104472
|
+
varDeclList
|
|
104473
|
+
);
|
|
104474
|
+
statements.push(varStatement);
|
|
104475
|
+
addRange(statements, exportStatements);
|
|
104476
|
+
const condition = visitNode(node.condition, visitor, isExpression);
|
|
104477
|
+
const incrementor = visitNode(node.incrementor, discardedValueVisitor, isExpression);
|
|
104478
|
+
const body = visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context);
|
|
104479
|
+
statements.push(factory2.updateForStatement(
|
|
104480
|
+
node,
|
|
104481
|
+
/*initializer*/
|
|
104482
|
+
void 0,
|
|
104483
|
+
condition,
|
|
104484
|
+
incrementor,
|
|
104485
|
+
body
|
|
104486
|
+
));
|
|
104487
|
+
return statements;
|
|
104488
|
+
}
|
|
104489
|
+
}
|
|
104396
104490
|
return factory2.updateForStatement(
|
|
104397
104491
|
node,
|
|
104398
104492
|
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
104399
104493
|
visitNode(node.condition, visitor, isExpression),
|
|
104400
104494
|
visitNode(node.incrementor, discardedValueVisitor, isExpression),
|
|
104401
|
-
visitIterationBody(node.statement, visitor, context)
|
|
104495
|
+
visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context)
|
|
104402
104496
|
);
|
|
104403
104497
|
}
|
|
104498
|
+
function visitForInStatement(node) {
|
|
104499
|
+
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
104500
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
104501
|
+
/*statements*/
|
|
104502
|
+
void 0,
|
|
104503
|
+
node.initializer,
|
|
104504
|
+
/*isForInOrOfInitializer*/
|
|
104505
|
+
true
|
|
104506
|
+
);
|
|
104507
|
+
if (some(exportStatements)) {
|
|
104508
|
+
const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
|
|
104509
|
+
const expression = visitNode(node.expression, visitor, isExpression);
|
|
104510
|
+
const body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
|
|
104511
|
+
const mergedBody = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
|
|
104512
|
+
[...exportStatements, body],
|
|
104513
|
+
/*multiLine*/
|
|
104514
|
+
true
|
|
104515
|
+
);
|
|
104516
|
+
return factory2.updateForInStatement(node, initializer, expression, mergedBody);
|
|
104517
|
+
}
|
|
104518
|
+
}
|
|
104519
|
+
return factory2.updateForInStatement(
|
|
104520
|
+
node,
|
|
104521
|
+
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
104522
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104523
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
104524
|
+
);
|
|
104525
|
+
}
|
|
104526
|
+
function visitForOfStatement(node) {
|
|
104527
|
+
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
104528
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
104529
|
+
/*statements*/
|
|
104530
|
+
void 0,
|
|
104531
|
+
node.initializer,
|
|
104532
|
+
/*isForInOrOfInitializer*/
|
|
104533
|
+
true
|
|
104534
|
+
);
|
|
104535
|
+
const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
|
|
104536
|
+
const expression = visitNode(node.expression, visitor, isExpression);
|
|
104537
|
+
let body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
|
|
104538
|
+
if (some(exportStatements)) {
|
|
104539
|
+
body = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
|
|
104540
|
+
[...exportStatements, body],
|
|
104541
|
+
/*multiLine*/
|
|
104542
|
+
true
|
|
104543
|
+
);
|
|
104544
|
+
}
|
|
104545
|
+
return factory2.updateForOfStatement(node, node.awaitModifier, initializer, expression, body);
|
|
104546
|
+
}
|
|
104547
|
+
return factory2.updateForOfStatement(
|
|
104548
|
+
node,
|
|
104549
|
+
node.awaitModifier,
|
|
104550
|
+
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
104551
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104552
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
104553
|
+
);
|
|
104554
|
+
}
|
|
104555
|
+
function visitDoStatement(node) {
|
|
104556
|
+
return factory2.updateDoStatement(
|
|
104557
|
+
node,
|
|
104558
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context),
|
|
104559
|
+
visitNode(node.expression, visitor, isExpression)
|
|
104560
|
+
);
|
|
104561
|
+
}
|
|
104562
|
+
function visitWhileStatement(node) {
|
|
104563
|
+
return factory2.updateWhileStatement(
|
|
104564
|
+
node,
|
|
104565
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104566
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
104567
|
+
);
|
|
104568
|
+
}
|
|
104569
|
+
function visitLabeledStatement(node) {
|
|
104570
|
+
return factory2.updateLabeledStatement(
|
|
104571
|
+
node,
|
|
104572
|
+
node.label,
|
|
104573
|
+
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
104574
|
+
);
|
|
104575
|
+
}
|
|
104576
|
+
function visitWithStatement(node) {
|
|
104577
|
+
return factory2.updateWithStatement(
|
|
104578
|
+
node,
|
|
104579
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104580
|
+
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
104581
|
+
);
|
|
104582
|
+
}
|
|
104583
|
+
function visitIfStatement(node) {
|
|
104584
|
+
return factory2.updateIfStatement(
|
|
104585
|
+
node,
|
|
104586
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104587
|
+
Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
|
|
104588
|
+
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
|
|
104589
|
+
);
|
|
104590
|
+
}
|
|
104591
|
+
function visitSwitchStatement(node) {
|
|
104592
|
+
return factory2.updateSwitchStatement(
|
|
104593
|
+
node,
|
|
104594
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104595
|
+
Debug.checkDefined(visitNode(node.caseBlock, topLevelNestedVisitor, isCaseBlock))
|
|
104596
|
+
);
|
|
104597
|
+
}
|
|
104598
|
+
function visitCaseBlock(node) {
|
|
104599
|
+
return factory2.updateCaseBlock(
|
|
104600
|
+
node,
|
|
104601
|
+
visitNodes2(node.clauses, topLevelNestedVisitor, isCaseOrDefaultClause)
|
|
104602
|
+
);
|
|
104603
|
+
}
|
|
104604
|
+
function visitCaseClause(node) {
|
|
104605
|
+
return factory2.updateCaseClause(
|
|
104606
|
+
node,
|
|
104607
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104608
|
+
visitNodes2(node.statements, topLevelNestedVisitor, isStatement)
|
|
104609
|
+
);
|
|
104610
|
+
}
|
|
104611
|
+
function visitDefaultClause(node) {
|
|
104612
|
+
return visitEachChild(node, topLevelNestedVisitor, context);
|
|
104613
|
+
}
|
|
104614
|
+
function visitTryStatement(node) {
|
|
104615
|
+
return visitEachChild(node, topLevelNestedVisitor, context);
|
|
104616
|
+
}
|
|
104617
|
+
function visitCatchClause(node) {
|
|
104618
|
+
return factory2.updateCatchClause(
|
|
104619
|
+
node,
|
|
104620
|
+
node.variableDeclaration,
|
|
104621
|
+
Debug.checkDefined(visitNode(node.block, topLevelNestedVisitor, isBlock))
|
|
104622
|
+
);
|
|
104623
|
+
}
|
|
104624
|
+
function visitBlock(node) {
|
|
104625
|
+
node = visitEachChild(node, topLevelNestedVisitor, context);
|
|
104626
|
+
return node;
|
|
104627
|
+
}
|
|
104404
104628
|
function visitExpressionStatement(node) {
|
|
104405
104629
|
return factory2.updateExpressionStatement(
|
|
104406
104630
|
node,
|
|
@@ -105193,25 +105417,33 @@ ${lanes.join("\n")}
|
|
|
105193
105417
|
return appendExportsOfDeclaration(statements, decl);
|
|
105194
105418
|
}
|
|
105195
105419
|
function appendExportsOfVariableStatement(statements, node) {
|
|
105420
|
+
return appendExportsOfVariableDeclarationList(
|
|
105421
|
+
statements,
|
|
105422
|
+
node.declarationList,
|
|
105423
|
+
/*isForInOrOfInitializer*/
|
|
105424
|
+
false
|
|
105425
|
+
);
|
|
105426
|
+
}
|
|
105427
|
+
function appendExportsOfVariableDeclarationList(statements, node, isForInOrOfInitializer) {
|
|
105196
105428
|
if (currentModuleInfo.exportEquals) {
|
|
105197
105429
|
return statements;
|
|
105198
105430
|
}
|
|
105199
|
-
for (const decl of node.
|
|
105200
|
-
statements = appendExportsOfBindingElement(statements, decl);
|
|
105431
|
+
for (const decl of node.declarations) {
|
|
105432
|
+
statements = appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer);
|
|
105201
105433
|
}
|
|
105202
105434
|
return statements;
|
|
105203
105435
|
}
|
|
105204
|
-
function appendExportsOfBindingElement(statements, decl) {
|
|
105436
|
+
function appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer) {
|
|
105205
105437
|
if (currentModuleInfo.exportEquals) {
|
|
105206
105438
|
return statements;
|
|
105207
105439
|
}
|
|
105208
105440
|
if (isBindingPattern(decl.name)) {
|
|
105209
105441
|
for (const element of decl.name.elements) {
|
|
105210
105442
|
if (!isOmittedExpression(element)) {
|
|
105211
|
-
statements = appendExportsOfBindingElement(statements, element);
|
|
105443
|
+
statements = appendExportsOfBindingElement(statements, element, isForInOrOfInitializer);
|
|
105212
105444
|
}
|
|
105213
105445
|
}
|
|
105214
|
-
} else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer)) {
|
|
105446
|
+
} else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer || isForInOrOfInitializer)) {
|
|
105215
105447
|
statements = appendExportsOfDeclaration(statements, decl);
|
|
105216
105448
|
}
|
|
105217
105449
|
return statements;
|
|
@@ -178983,7 +179215,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178983
179215
|
getApplicableRefactors(args) {
|
|
178984
179216
|
const { file, project } = this.getFileAndProject(args);
|
|
178985
179217
|
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
|
178986
|
-
return project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind);
|
|
179218
|
+
return project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind, args.includeInteractiveActions);
|
|
178987
179219
|
}
|
|
178988
179220
|
getEditsForRefactor(args, simplifiedResult) {
|
|
178989
179221
|
const { file, project } = this.getFileAndProject(args);
|
package/lib/typescript.d.ts
CHANGED
|
@@ -550,7 +550,7 @@ declare namespace ts {
|
|
|
550
550
|
interface FlowContainer extends Node {
|
|
551
551
|
_flowContainerBrand: any;
|
|
552
552
|
}
|
|
553
|
-
type HasJSDoc = AccessorDeclaration | ArrowFunction | BinaryExpression | Block | BreakStatement | CallSignatureDeclaration | CaseClause | ClassLikeDeclaration | ClassStaticBlockDeclaration | ConstructorDeclaration | ConstructorTypeNode | ConstructSignatureDeclaration | ContinueStatement | DebuggerStatement | DoStatement | ElementAccessExpression | EmptyStatement | EndOfFileToken | EnumDeclaration | EnumMember | ExportAssignment | ExportDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeNode | Identifier | IfStatement | ImportDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | InterfaceDeclaration | JSDocFunctionType | JSDocSignature | LabeledStatement | MethodDeclaration | MethodSignature | ModuleDeclaration | NamedTupleMember | NamespaceExportDeclaration | ObjectLiteralExpression | ParameterDeclaration | ParenthesizedExpression | PropertyAccessExpression | PropertyAssignment | PropertyDeclaration | PropertySignature | ReturnStatement | ShorthandPropertyAssignment | SpreadAssignment | SwitchStatement | ThrowStatement | TryStatement | TypeAliasDeclaration | TypeParameterDeclaration | VariableDeclaration | VariableStatement | WhileStatement | WithStatement;
|
|
553
|
+
type HasJSDoc = AccessorDeclaration | ArrowFunction | BinaryExpression | Block | BreakStatement | CallSignatureDeclaration | CaseClause | ClassLikeDeclaration | ClassStaticBlockDeclaration | ConstructorDeclaration | ConstructorTypeNode | ConstructSignatureDeclaration | ContinueStatement | DebuggerStatement | DoStatement | ElementAccessExpression | EmptyStatement | EndOfFileToken | EnumDeclaration | EnumMember | ExportAssignment | ExportDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeNode | Identifier | IfStatement | ImportDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | InterfaceDeclaration | JSDocFunctionType | JSDocSignature | LabeledStatement | MethodDeclaration | MethodSignature | ModuleDeclaration | NamedTupleMember | NamespaceExportDeclaration | ObjectLiteralExpression | ParameterDeclaration | ParenthesizedExpression | PropertyAccessExpression | PropertyAssignment | PropertyDeclaration | PropertySignature | ReturnStatement | SemicolonClassElement | ShorthandPropertyAssignment | SpreadAssignment | SwitchStatement | ThrowStatement | TryStatement | TypeAliasDeclaration | TypeParameterDeclaration | VariableDeclaration | VariableStatement | WhileStatement | WithStatement;
|
|
554
554
|
type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
|
|
555
555
|
type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement;
|
|
556
556
|
type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
|
|
@@ -829,7 +829,7 @@ declare namespace ts {
|
|
|
829
829
|
readonly body?: FunctionBody | undefined;
|
|
830
830
|
}
|
|
831
831
|
/** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
|
|
832
|
-
interface SemicolonClassElement extends ClassElement {
|
|
832
|
+
interface SemicolonClassElement extends ClassElement, JSDocContainer {
|
|
833
833
|
readonly kind: SyntaxKind.SemicolonClassElement;
|
|
834
834
|
readonly parent: ClassLikeDeclaration;
|
|
835
835
|
}
|