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/tsserver.js
CHANGED
|
@@ -2303,7 +2303,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2303
2303
|
|
|
2304
2304
|
// src/compiler/corePublic.ts
|
|
2305
2305
|
var versionMajorMinor = "5.1";
|
|
2306
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2306
|
+
var version = `${versionMajorMinor}.0-dev.20230429`;
|
|
2307
2307
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2308
2308
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2309
2309
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17584,6 +17584,7 @@ function canHaveJSDoc(node) {
|
|
|
17584
17584
|
case 171 /* PropertyDeclaration */:
|
|
17585
17585
|
case 170 /* PropertySignature */:
|
|
17586
17586
|
case 252 /* ReturnStatement */:
|
|
17587
|
+
case 239 /* SemicolonClassElement */:
|
|
17587
17588
|
case 177 /* SetAccessor */:
|
|
17588
17589
|
case 303 /* ShorthandPropertyAssignment */:
|
|
17589
17590
|
case 304 /* SpreadAssignment */:
|
|
@@ -35486,11 +35487,11 @@ var Parser;
|
|
|
35486
35487
|
}
|
|
35487
35488
|
function parseClassElement() {
|
|
35488
35489
|
const pos = getNodePos();
|
|
35490
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
35489
35491
|
if (token() === 27 /* SemicolonToken */) {
|
|
35490
35492
|
nextToken();
|
|
35491
|
-
return finishNode(factory2.createSemicolonClassElement(), pos);
|
|
35493
|
+
return withJSDoc(finishNode(factory2.createSemicolonClassElement(), pos), hasJSDoc);
|
|
35492
35494
|
}
|
|
35493
|
-
const hasJSDoc = hasPrecedingJSDocComment();
|
|
35494
35495
|
const modifiers = parseModifiers(
|
|
35495
35496
|
/*allowDecorators*/
|
|
35496
35497
|
true,
|
|
@@ -48291,13 +48292,14 @@ function createTypeChecker(host) {
|
|
|
48291
48292
|
return diagnostic;
|
|
48292
48293
|
}
|
|
48293
48294
|
function isDeprecatedSymbol(symbol) {
|
|
48294
|
-
|
|
48295
|
-
|
|
48296
|
-
|
|
48297
|
-
return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
|
|
48298
|
-
}
|
|
48295
|
+
const parentSymbol = getParentOfSymbol(symbol);
|
|
48296
|
+
if (parentSymbol && length(symbol.declarations) > 1) {
|
|
48297
|
+
return parentSymbol.flags & 64 /* Interface */ ? some(symbol.declarations, isDeprecatedDeclaration2) : every(symbol.declarations, isDeprecatedDeclaration2);
|
|
48299
48298
|
}
|
|
48300
|
-
return !!(
|
|
48299
|
+
return !!symbol.valueDeclaration && isDeprecatedDeclaration2(symbol.valueDeclaration) || length(symbol.declarations) && every(symbol.declarations, isDeprecatedDeclaration2);
|
|
48300
|
+
}
|
|
48301
|
+
function isDeprecatedDeclaration2(declaration) {
|
|
48302
|
+
return !!(getCombinedNodeFlags(declaration) & 268435456 /* Deprecated */);
|
|
48301
48303
|
}
|
|
48302
48304
|
function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
|
|
48303
48305
|
const diagnostic = createDiagnosticForNode(location, Diagnostics._0_is_deprecated, deprecatedEntity);
|
|
@@ -70457,7 +70459,7 @@ function createTypeChecker(host) {
|
|
|
70457
70459
|
markAliasReferenced(symbol, node);
|
|
70458
70460
|
}
|
|
70459
70461
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
70460
|
-
const targetSymbol =
|
|
70462
|
+
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
70461
70463
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
70462
70464
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
70463
70465
|
}
|
|
@@ -73461,8 +73463,9 @@ function createTypeChecker(host) {
|
|
|
73461
73463
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
73462
73464
|
}
|
|
73463
73465
|
} else {
|
|
73464
|
-
|
|
73465
|
-
|
|
73466
|
+
const targetPropSymbol = resolveAliasWithDeprecationCheck(prop, right);
|
|
73467
|
+
if (isDeprecatedSymbol(targetPropSymbol) && isUncalledFunctionReference(node, targetPropSymbol) && targetPropSymbol.declarations) {
|
|
73468
|
+
addDeprecatedSuggestion(right, targetPropSymbol.declarations, right.escapedText);
|
|
73466
73469
|
}
|
|
73467
73470
|
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
|
|
73468
73471
|
markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
|
|
@@ -83738,19 +83741,17 @@ function createTypeChecker(host) {
|
|
|
83738
83741
|
}
|
|
83739
83742
|
}
|
|
83740
83743
|
if (isImportSpecifier(node)) {
|
|
83741
|
-
const targetSymbol =
|
|
83742
|
-
if (
|
|
83744
|
+
const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
|
|
83745
|
+
if (isDeprecatedSymbol(targetSymbol) && targetSymbol.declarations) {
|
|
83743
83746
|
addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
|
|
83744
83747
|
}
|
|
83745
83748
|
}
|
|
83746
83749
|
}
|
|
83747
83750
|
}
|
|
83748
|
-
function
|
|
83749
|
-
|
|
83750
|
-
}
|
|
83751
|
-
function checkDeprecatedAliasedSymbol(symbol, location) {
|
|
83752
|
-
if (!(symbol.flags & 2097152 /* Alias */))
|
|
83751
|
+
function resolveAliasWithDeprecationCheck(symbol, location) {
|
|
83752
|
+
if (!(symbol.flags & 2097152 /* Alias */) || isDeprecatedSymbol(symbol) || !getDeclarationOfAliasSymbol(symbol)) {
|
|
83753
83753
|
return symbol;
|
|
83754
|
+
}
|
|
83754
83755
|
const targetSymbol = resolveAlias(symbol);
|
|
83755
83756
|
if (targetSymbol === unknownSymbol)
|
|
83756
83757
|
return targetSymbol;
|
|
@@ -83760,7 +83761,7 @@ function createTypeChecker(host) {
|
|
|
83760
83761
|
if (target === targetSymbol)
|
|
83761
83762
|
break;
|
|
83762
83763
|
if (target.declarations && length(target.declarations)) {
|
|
83763
|
-
if (
|
|
83764
|
+
if (isDeprecatedSymbol(target)) {
|
|
83764
83765
|
addDeprecatedSuggestion(location, target.declarations, target.escapedName);
|
|
83765
83766
|
break;
|
|
83766
83767
|
} else {
|
|
@@ -95234,6 +95235,19 @@ function transformLegacyDecorators(context) {
|
|
|
95234
95235
|
let members = visitNodes2(node.members, visitor, isClassElement);
|
|
95235
95236
|
let decorationStatements = [];
|
|
95236
95237
|
({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
|
|
95238
|
+
const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member, 32 /* Static */) || isClassStaticBlockDeclaration(member));
|
|
95239
|
+
if (assignClassAliasInStaticBlock) {
|
|
95240
|
+
members = setTextRange(factory2.createNodeArray([
|
|
95241
|
+
factory2.createClassStaticBlockDeclaration(
|
|
95242
|
+
factory2.createBlock([
|
|
95243
|
+
factory2.createExpressionStatement(
|
|
95244
|
+
factory2.createAssignment(classAlias, factory2.createThis())
|
|
95245
|
+
)
|
|
95246
|
+
])
|
|
95247
|
+
),
|
|
95248
|
+
...members
|
|
95249
|
+
]), members);
|
|
95250
|
+
}
|
|
95237
95251
|
const classExpression = factory2.createClassExpression(
|
|
95238
95252
|
modifiers,
|
|
95239
95253
|
name && isGeneratedIdentifier(name) ? void 0 : name,
|
|
@@ -95250,7 +95264,7 @@ function transformLegacyDecorators(context) {
|
|
|
95250
95264
|
void 0,
|
|
95251
95265
|
/*type*/
|
|
95252
95266
|
void 0,
|
|
95253
|
-
classAlias ? factory2.createAssignment(classAlias, classExpression) : classExpression
|
|
95267
|
+
classAlias && !assignClassAliasInStaticBlock ? factory2.createAssignment(classAlias, classExpression) : classExpression
|
|
95254
95268
|
);
|
|
95255
95269
|
setOriginalNode(varDecl, node);
|
|
95256
95270
|
let varModifiers;
|
|
@@ -106233,12 +106247,56 @@ function transformModule(context) {
|
|
|
106233
106247
|
return visitExportDeclaration(node);
|
|
106234
106248
|
case 276 /* ExportAssignment */:
|
|
106235
106249
|
return visitExportAssignment(node);
|
|
106250
|
+
case 261 /* FunctionDeclaration */:
|
|
106251
|
+
return visitFunctionDeclaration(node);
|
|
106252
|
+
case 262 /* ClassDeclaration */:
|
|
106253
|
+
return visitClassDeclaration(node);
|
|
106254
|
+
default:
|
|
106255
|
+
return topLevelNestedVisitor(node);
|
|
106256
|
+
}
|
|
106257
|
+
}
|
|
106258
|
+
function topLevelNestedVisitor(node) {
|
|
106259
|
+
switch (node.kind) {
|
|
106236
106260
|
case 242 /* VariableStatement */:
|
|
106237
106261
|
return visitVariableStatement(node);
|
|
106238
106262
|
case 261 /* FunctionDeclaration */:
|
|
106239
106263
|
return visitFunctionDeclaration(node);
|
|
106240
106264
|
case 262 /* ClassDeclaration */:
|
|
106241
106265
|
return visitClassDeclaration(node);
|
|
106266
|
+
case 247 /* ForStatement */:
|
|
106267
|
+
return visitForStatement(
|
|
106268
|
+
node,
|
|
106269
|
+
/*isTopLevel*/
|
|
106270
|
+
true
|
|
106271
|
+
);
|
|
106272
|
+
case 248 /* ForInStatement */:
|
|
106273
|
+
return visitForInStatement(node);
|
|
106274
|
+
case 249 /* ForOfStatement */:
|
|
106275
|
+
return visitForOfStatement(node);
|
|
106276
|
+
case 245 /* DoStatement */:
|
|
106277
|
+
return visitDoStatement(node);
|
|
106278
|
+
case 246 /* WhileStatement */:
|
|
106279
|
+
return visitWhileStatement(node);
|
|
106280
|
+
case 255 /* LabeledStatement */:
|
|
106281
|
+
return visitLabeledStatement(node);
|
|
106282
|
+
case 253 /* WithStatement */:
|
|
106283
|
+
return visitWithStatement(node);
|
|
106284
|
+
case 244 /* IfStatement */:
|
|
106285
|
+
return visitIfStatement(node);
|
|
106286
|
+
case 254 /* SwitchStatement */:
|
|
106287
|
+
return visitSwitchStatement(node);
|
|
106288
|
+
case 268 /* CaseBlock */:
|
|
106289
|
+
return visitCaseBlock(node);
|
|
106290
|
+
case 295 /* CaseClause */:
|
|
106291
|
+
return visitCaseClause(node);
|
|
106292
|
+
case 296 /* DefaultClause */:
|
|
106293
|
+
return visitDefaultClause(node);
|
|
106294
|
+
case 257 /* TryStatement */:
|
|
106295
|
+
return visitTryStatement(node);
|
|
106296
|
+
case 298 /* CatchClause */:
|
|
106297
|
+
return visitCatchClause(node);
|
|
106298
|
+
case 240 /* Block */:
|
|
106299
|
+
return visitBlock(node);
|
|
106242
106300
|
default:
|
|
106243
106301
|
return visitor(node);
|
|
106244
106302
|
}
|
|
@@ -106249,7 +106307,11 @@ function transformModule(context) {
|
|
|
106249
106307
|
}
|
|
106250
106308
|
switch (node.kind) {
|
|
106251
106309
|
case 247 /* ForStatement */:
|
|
106252
|
-
return visitForStatement(
|
|
106310
|
+
return visitForStatement(
|
|
106311
|
+
node,
|
|
106312
|
+
/*isTopLevel*/
|
|
106313
|
+
false
|
|
106314
|
+
);
|
|
106253
106315
|
case 243 /* ExpressionStatement */:
|
|
106254
106316
|
return visitExpressionStatement(node);
|
|
106255
106317
|
case 216 /* ParenthesizedExpression */:
|
|
@@ -106334,15 +106396,177 @@ function transformModule(context) {
|
|
|
106334
106396
|
}
|
|
106335
106397
|
return visitEachChild(node, visitor, context);
|
|
106336
106398
|
}
|
|
106337
|
-
function visitForStatement(node) {
|
|
106399
|
+
function visitForStatement(node, isTopLevel) {
|
|
106400
|
+
if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
106401
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
106402
|
+
/*statements*/
|
|
106403
|
+
void 0,
|
|
106404
|
+
node.initializer,
|
|
106405
|
+
/*isForInOrOfInitializer*/
|
|
106406
|
+
false
|
|
106407
|
+
);
|
|
106408
|
+
if (exportStatements) {
|
|
106409
|
+
const statements = [];
|
|
106410
|
+
const varDeclList = visitNode(node.initializer, discardedValueVisitor, isVariableDeclarationList);
|
|
106411
|
+
const varStatement = factory2.createVariableStatement(
|
|
106412
|
+
/*modifiers*/
|
|
106413
|
+
void 0,
|
|
106414
|
+
varDeclList
|
|
106415
|
+
);
|
|
106416
|
+
statements.push(varStatement);
|
|
106417
|
+
addRange(statements, exportStatements);
|
|
106418
|
+
const condition = visitNode(node.condition, visitor, isExpression);
|
|
106419
|
+
const incrementor = visitNode(node.incrementor, discardedValueVisitor, isExpression);
|
|
106420
|
+
const body = visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context);
|
|
106421
|
+
statements.push(factory2.updateForStatement(
|
|
106422
|
+
node,
|
|
106423
|
+
/*initializer*/
|
|
106424
|
+
void 0,
|
|
106425
|
+
condition,
|
|
106426
|
+
incrementor,
|
|
106427
|
+
body
|
|
106428
|
+
));
|
|
106429
|
+
return statements;
|
|
106430
|
+
}
|
|
106431
|
+
}
|
|
106338
106432
|
return factory2.updateForStatement(
|
|
106339
106433
|
node,
|
|
106340
106434
|
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
106341
106435
|
visitNode(node.condition, visitor, isExpression),
|
|
106342
106436
|
visitNode(node.incrementor, discardedValueVisitor, isExpression),
|
|
106343
|
-
visitIterationBody(node.statement, visitor, context)
|
|
106437
|
+
visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context)
|
|
106438
|
+
);
|
|
106439
|
+
}
|
|
106440
|
+
function visitForInStatement(node) {
|
|
106441
|
+
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
106442
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
106443
|
+
/*statements*/
|
|
106444
|
+
void 0,
|
|
106445
|
+
node.initializer,
|
|
106446
|
+
/*isForInOrOfInitializer*/
|
|
106447
|
+
true
|
|
106448
|
+
);
|
|
106449
|
+
if (some(exportStatements)) {
|
|
106450
|
+
const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
|
|
106451
|
+
const expression = visitNode(node.expression, visitor, isExpression);
|
|
106452
|
+
const body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
|
|
106453
|
+
const mergedBody = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
|
|
106454
|
+
[...exportStatements, body],
|
|
106455
|
+
/*multiLine*/
|
|
106456
|
+
true
|
|
106457
|
+
);
|
|
106458
|
+
return factory2.updateForInStatement(node, initializer, expression, mergedBody);
|
|
106459
|
+
}
|
|
106460
|
+
}
|
|
106461
|
+
return factory2.updateForInStatement(
|
|
106462
|
+
node,
|
|
106463
|
+
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
106464
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106465
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
106466
|
+
);
|
|
106467
|
+
}
|
|
106468
|
+
function visitForOfStatement(node) {
|
|
106469
|
+
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
106470
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
106471
|
+
/*statements*/
|
|
106472
|
+
void 0,
|
|
106473
|
+
node.initializer,
|
|
106474
|
+
/*isForInOrOfInitializer*/
|
|
106475
|
+
true
|
|
106476
|
+
);
|
|
106477
|
+
const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
|
|
106478
|
+
const expression = visitNode(node.expression, visitor, isExpression);
|
|
106479
|
+
let body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
|
|
106480
|
+
if (some(exportStatements)) {
|
|
106481
|
+
body = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
|
|
106482
|
+
[...exportStatements, body],
|
|
106483
|
+
/*multiLine*/
|
|
106484
|
+
true
|
|
106485
|
+
);
|
|
106486
|
+
}
|
|
106487
|
+
return factory2.updateForOfStatement(node, node.awaitModifier, initializer, expression, body);
|
|
106488
|
+
}
|
|
106489
|
+
return factory2.updateForOfStatement(
|
|
106490
|
+
node,
|
|
106491
|
+
node.awaitModifier,
|
|
106492
|
+
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
106493
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106494
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
106495
|
+
);
|
|
106496
|
+
}
|
|
106497
|
+
function visitDoStatement(node) {
|
|
106498
|
+
return factory2.updateDoStatement(
|
|
106499
|
+
node,
|
|
106500
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context),
|
|
106501
|
+
visitNode(node.expression, visitor, isExpression)
|
|
106344
106502
|
);
|
|
106345
106503
|
}
|
|
106504
|
+
function visitWhileStatement(node) {
|
|
106505
|
+
return factory2.updateWhileStatement(
|
|
106506
|
+
node,
|
|
106507
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106508
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
106509
|
+
);
|
|
106510
|
+
}
|
|
106511
|
+
function visitLabeledStatement(node) {
|
|
106512
|
+
return factory2.updateLabeledStatement(
|
|
106513
|
+
node,
|
|
106514
|
+
node.label,
|
|
106515
|
+
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
106516
|
+
);
|
|
106517
|
+
}
|
|
106518
|
+
function visitWithStatement(node) {
|
|
106519
|
+
return factory2.updateWithStatement(
|
|
106520
|
+
node,
|
|
106521
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106522
|
+
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
106523
|
+
);
|
|
106524
|
+
}
|
|
106525
|
+
function visitIfStatement(node) {
|
|
106526
|
+
return factory2.updateIfStatement(
|
|
106527
|
+
node,
|
|
106528
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106529
|
+
Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
|
|
106530
|
+
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
|
|
106531
|
+
);
|
|
106532
|
+
}
|
|
106533
|
+
function visitSwitchStatement(node) {
|
|
106534
|
+
return factory2.updateSwitchStatement(
|
|
106535
|
+
node,
|
|
106536
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106537
|
+
Debug.checkDefined(visitNode(node.caseBlock, topLevelNestedVisitor, isCaseBlock))
|
|
106538
|
+
);
|
|
106539
|
+
}
|
|
106540
|
+
function visitCaseBlock(node) {
|
|
106541
|
+
return factory2.updateCaseBlock(
|
|
106542
|
+
node,
|
|
106543
|
+
visitNodes2(node.clauses, topLevelNestedVisitor, isCaseOrDefaultClause)
|
|
106544
|
+
);
|
|
106545
|
+
}
|
|
106546
|
+
function visitCaseClause(node) {
|
|
106547
|
+
return factory2.updateCaseClause(
|
|
106548
|
+
node,
|
|
106549
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106550
|
+
visitNodes2(node.statements, topLevelNestedVisitor, isStatement)
|
|
106551
|
+
);
|
|
106552
|
+
}
|
|
106553
|
+
function visitDefaultClause(node) {
|
|
106554
|
+
return visitEachChild(node, topLevelNestedVisitor, context);
|
|
106555
|
+
}
|
|
106556
|
+
function visitTryStatement(node) {
|
|
106557
|
+
return visitEachChild(node, topLevelNestedVisitor, context);
|
|
106558
|
+
}
|
|
106559
|
+
function visitCatchClause(node) {
|
|
106560
|
+
return factory2.updateCatchClause(
|
|
106561
|
+
node,
|
|
106562
|
+
node.variableDeclaration,
|
|
106563
|
+
Debug.checkDefined(visitNode(node.block, topLevelNestedVisitor, isBlock))
|
|
106564
|
+
);
|
|
106565
|
+
}
|
|
106566
|
+
function visitBlock(node) {
|
|
106567
|
+
node = visitEachChild(node, topLevelNestedVisitor, context);
|
|
106568
|
+
return node;
|
|
106569
|
+
}
|
|
106346
106570
|
function visitExpressionStatement(node) {
|
|
106347
106571
|
return factory2.updateExpressionStatement(
|
|
106348
106572
|
node,
|
|
@@ -107135,25 +107359,33 @@ function transformModule(context) {
|
|
|
107135
107359
|
return appendExportsOfDeclaration(statements, decl);
|
|
107136
107360
|
}
|
|
107137
107361
|
function appendExportsOfVariableStatement(statements, node) {
|
|
107362
|
+
return appendExportsOfVariableDeclarationList(
|
|
107363
|
+
statements,
|
|
107364
|
+
node.declarationList,
|
|
107365
|
+
/*isForInOrOfInitializer*/
|
|
107366
|
+
false
|
|
107367
|
+
);
|
|
107368
|
+
}
|
|
107369
|
+
function appendExportsOfVariableDeclarationList(statements, node, isForInOrOfInitializer) {
|
|
107138
107370
|
if (currentModuleInfo.exportEquals) {
|
|
107139
107371
|
return statements;
|
|
107140
107372
|
}
|
|
107141
|
-
for (const decl of node.
|
|
107142
|
-
statements = appendExportsOfBindingElement(statements, decl);
|
|
107373
|
+
for (const decl of node.declarations) {
|
|
107374
|
+
statements = appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer);
|
|
107143
107375
|
}
|
|
107144
107376
|
return statements;
|
|
107145
107377
|
}
|
|
107146
|
-
function appendExportsOfBindingElement(statements, decl) {
|
|
107378
|
+
function appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer) {
|
|
107147
107379
|
if (currentModuleInfo.exportEquals) {
|
|
107148
107380
|
return statements;
|
|
107149
107381
|
}
|
|
107150
107382
|
if (isBindingPattern(decl.name)) {
|
|
107151
107383
|
for (const element of decl.name.elements) {
|
|
107152
107384
|
if (!isOmittedExpression(element)) {
|
|
107153
|
-
statements = appendExportsOfBindingElement(statements, element);
|
|
107385
|
+
statements = appendExportsOfBindingElement(statements, element, isForInOrOfInitializer);
|
|
107154
107386
|
}
|
|
107155
107387
|
}
|
|
107156
|
-
} else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer)) {
|
|
107388
|
+
} else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer || isForInOrOfInitializer)) {
|
|
107157
107389
|
statements = appendExportsOfDeclaration(statements, decl);
|
|
107158
107390
|
}
|
|
107159
107391
|
return statements;
|
|
@@ -181544,7 +181776,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181544
181776
|
getApplicableRefactors(args) {
|
|
181545
181777
|
const { file, project } = this.getFileAndProject(args);
|
|
181546
181778
|
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
|
181547
|
-
return project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind);
|
|
181779
|
+
return project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind, args.includeInteractiveActions);
|
|
181548
181780
|
}
|
|
181549
181781
|
getEditsForRefactor(args, simplifiedResult) {
|
|
181550
181782
|
const { file, project } = this.getFileAndProject(args);
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -4597,7 +4597,7 @@ declare namespace ts {
|
|
|
4597
4597
|
interface FlowContainer extends Node {
|
|
4598
4598
|
_flowContainerBrand: any;
|
|
4599
4599
|
}
|
|
4600
|
-
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;
|
|
4600
|
+
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;
|
|
4601
4601
|
type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
|
|
4602
4602
|
type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement;
|
|
4603
4603
|
type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
|
|
@@ -4876,7 +4876,7 @@ declare namespace ts {
|
|
|
4876
4876
|
readonly body?: FunctionBody | undefined;
|
|
4877
4877
|
}
|
|
4878
4878
|
/** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
|
|
4879
|
-
interface SemicolonClassElement extends ClassElement {
|
|
4879
|
+
interface SemicolonClassElement extends ClassElement, JSDocContainer {
|
|
4880
4880
|
readonly kind: SyntaxKind.SemicolonClassElement;
|
|
4881
4881
|
readonly parent: ClassLikeDeclaration;
|
|
4882
4882
|
}
|