typescript 5.1.0-dev.20230427 → 5.1.0-dev.20230428

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/typescript.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.20230427`;
38
+ version = `${versionMajorMinor}.0-dev.20230428`;
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
- if (length(symbol.declarations) > 1) {
46087
- const parentSymbol = getParentOfSymbol(symbol);
46088
- if (parentSymbol && parentSymbol.flags & 64 /* Interface */) {
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 !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456 /* Deprecated */);
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 = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
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
- if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
71257
- addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
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 = checkDeprecatedAliasedSymbol(symbol, node);
81534
- if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
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 isDeprecatedAliasedSymbol(symbol) {
81541
- return !!symbol.declarations && every(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
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 (isDeprecatedAliasedSymbol(target)) {
81556
+ if (isDeprecatedSymbol(target)) {
81556
81557
  addDeprecatedSuggestion(location, target.declarations, target.escapedName);
81557
81558
  break;
81558
81559
  } else {
@@ -104291,12 +104292,56 @@ ${lanes.join("\n")}
104291
104292
  return visitExportDeclaration(node);
104292
104293
  case 276 /* ExportAssignment */:
104293
104294
  return visitExportAssignment(node);
104295
+ case 261 /* FunctionDeclaration */:
104296
+ return visitFunctionDeclaration(node);
104297
+ case 262 /* ClassDeclaration */:
104298
+ return visitClassDeclaration(node);
104299
+ default:
104300
+ return topLevelNestedVisitor(node);
104301
+ }
104302
+ }
104303
+ function topLevelNestedVisitor(node) {
104304
+ switch (node.kind) {
104294
104305
  case 242 /* VariableStatement */:
104295
104306
  return visitVariableStatement(node);
104296
104307
  case 261 /* FunctionDeclaration */:
104297
104308
  return visitFunctionDeclaration(node);
104298
104309
  case 262 /* ClassDeclaration */:
104299
104310
  return visitClassDeclaration(node);
104311
+ case 247 /* ForStatement */:
104312
+ return visitForStatement(
104313
+ node,
104314
+ /*isTopLevel*/
104315
+ true
104316
+ );
104317
+ case 248 /* ForInStatement */:
104318
+ return visitForInStatement(node);
104319
+ case 249 /* ForOfStatement */:
104320
+ return visitForOfStatement(node);
104321
+ case 245 /* DoStatement */:
104322
+ return visitDoStatement(node);
104323
+ case 246 /* WhileStatement */:
104324
+ return visitWhileStatement(node);
104325
+ case 255 /* LabeledStatement */:
104326
+ return visitLabeledStatement(node);
104327
+ case 253 /* WithStatement */:
104328
+ return visitWithStatement(node);
104329
+ case 244 /* IfStatement */:
104330
+ return visitIfStatement(node);
104331
+ case 254 /* SwitchStatement */:
104332
+ return visitSwitchStatement(node);
104333
+ case 268 /* CaseBlock */:
104334
+ return visitCaseBlock(node);
104335
+ case 295 /* CaseClause */:
104336
+ return visitCaseClause(node);
104337
+ case 296 /* DefaultClause */:
104338
+ return visitDefaultClause(node);
104339
+ case 257 /* TryStatement */:
104340
+ return visitTryStatement(node);
104341
+ case 298 /* CatchClause */:
104342
+ return visitCatchClause(node);
104343
+ case 240 /* Block */:
104344
+ return visitBlock(node);
104300
104345
  default:
104301
104346
  return visitor(node);
104302
104347
  }
@@ -104307,7 +104352,11 @@ ${lanes.join("\n")}
104307
104352
  }
104308
104353
  switch (node.kind) {
104309
104354
  case 247 /* ForStatement */:
104310
- return visitForStatement(node);
104355
+ return visitForStatement(
104356
+ node,
104357
+ /*isTopLevel*/
104358
+ false
104359
+ );
104311
104360
  case 243 /* ExpressionStatement */:
104312
104361
  return visitExpressionStatement(node);
104313
104362
  case 216 /* ParenthesizedExpression */:
@@ -104392,15 +104441,177 @@ ${lanes.join("\n")}
104392
104441
  }
104393
104442
  return visitEachChild(node, visitor, context);
104394
104443
  }
104395
- function visitForStatement(node) {
104444
+ function visitForStatement(node, isTopLevel) {
104445
+ if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
104446
+ const exportStatements = appendExportsOfVariableDeclarationList(
104447
+ /*statements*/
104448
+ void 0,
104449
+ node.initializer,
104450
+ /*isForInOrOfInitializer*/
104451
+ false
104452
+ );
104453
+ if (exportStatements) {
104454
+ const statements = [];
104455
+ const varDeclList = visitNode(node.initializer, discardedValueVisitor, isVariableDeclarationList);
104456
+ const varStatement = factory2.createVariableStatement(
104457
+ /*modifiers*/
104458
+ void 0,
104459
+ varDeclList
104460
+ );
104461
+ statements.push(varStatement);
104462
+ addRange(statements, exportStatements);
104463
+ const condition = visitNode(node.condition, visitor, isExpression);
104464
+ const incrementor = visitNode(node.incrementor, discardedValueVisitor, isExpression);
104465
+ const body = visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context);
104466
+ statements.push(factory2.updateForStatement(
104467
+ node,
104468
+ /*initializer*/
104469
+ void 0,
104470
+ condition,
104471
+ incrementor,
104472
+ body
104473
+ ));
104474
+ return statements;
104475
+ }
104476
+ }
104396
104477
  return factory2.updateForStatement(
104397
104478
  node,
104398
104479
  visitNode(node.initializer, discardedValueVisitor, isForInitializer),
104399
104480
  visitNode(node.condition, visitor, isExpression),
104400
104481
  visitNode(node.incrementor, discardedValueVisitor, isExpression),
104401
- visitIterationBody(node.statement, visitor, context)
104482
+ visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context)
104483
+ );
104484
+ }
104485
+ function visitForInStatement(node) {
104486
+ if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
104487
+ const exportStatements = appendExportsOfVariableDeclarationList(
104488
+ /*statements*/
104489
+ void 0,
104490
+ node.initializer,
104491
+ /*isForInOrOfInitializer*/
104492
+ true
104493
+ );
104494
+ if (some(exportStatements)) {
104495
+ const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
104496
+ const expression = visitNode(node.expression, visitor, isExpression);
104497
+ const body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
104498
+ const mergedBody = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
104499
+ [...exportStatements, body],
104500
+ /*multiLine*/
104501
+ true
104502
+ );
104503
+ return factory2.updateForInStatement(node, initializer, expression, mergedBody);
104504
+ }
104505
+ }
104506
+ return factory2.updateForInStatement(
104507
+ node,
104508
+ visitNode(node.initializer, discardedValueVisitor, isForInitializer),
104509
+ visitNode(node.expression, visitor, isExpression),
104510
+ visitIterationBody(node.statement, topLevelNestedVisitor, context)
104511
+ );
104512
+ }
104513
+ function visitForOfStatement(node) {
104514
+ if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
104515
+ const exportStatements = appendExportsOfVariableDeclarationList(
104516
+ /*statements*/
104517
+ void 0,
104518
+ node.initializer,
104519
+ /*isForInOrOfInitializer*/
104520
+ true
104521
+ );
104522
+ const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
104523
+ const expression = visitNode(node.expression, visitor, isExpression);
104524
+ let body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
104525
+ if (some(exportStatements)) {
104526
+ body = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
104527
+ [...exportStatements, body],
104528
+ /*multiLine*/
104529
+ true
104530
+ );
104531
+ }
104532
+ return factory2.updateForOfStatement(node, node.awaitModifier, initializer, expression, body);
104533
+ }
104534
+ return factory2.updateForOfStatement(
104535
+ node,
104536
+ node.awaitModifier,
104537
+ visitNode(node.initializer, discardedValueVisitor, isForInitializer),
104538
+ visitNode(node.expression, visitor, isExpression),
104539
+ visitIterationBody(node.statement, topLevelNestedVisitor, context)
104540
+ );
104541
+ }
104542
+ function visitDoStatement(node) {
104543
+ return factory2.updateDoStatement(
104544
+ node,
104545
+ visitIterationBody(node.statement, topLevelNestedVisitor, context),
104546
+ visitNode(node.expression, visitor, isExpression)
104547
+ );
104548
+ }
104549
+ function visitWhileStatement(node) {
104550
+ return factory2.updateWhileStatement(
104551
+ node,
104552
+ visitNode(node.expression, visitor, isExpression),
104553
+ visitIterationBody(node.statement, topLevelNestedVisitor, context)
104554
+ );
104555
+ }
104556
+ function visitLabeledStatement(node) {
104557
+ return factory2.updateLabeledStatement(
104558
+ node,
104559
+ node.label,
104560
+ Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
104561
+ );
104562
+ }
104563
+ function visitWithStatement(node) {
104564
+ return factory2.updateWithStatement(
104565
+ node,
104566
+ visitNode(node.expression, visitor, isExpression),
104567
+ Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
104568
+ );
104569
+ }
104570
+ function visitIfStatement(node) {
104571
+ return factory2.updateIfStatement(
104572
+ node,
104573
+ visitNode(node.expression, visitor, isExpression),
104574
+ Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
104575
+ visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
104576
+ );
104577
+ }
104578
+ function visitSwitchStatement(node) {
104579
+ return factory2.updateSwitchStatement(
104580
+ node,
104581
+ visitNode(node.expression, visitor, isExpression),
104582
+ Debug.checkDefined(visitNode(node.caseBlock, topLevelNestedVisitor, isCaseBlock))
104583
+ );
104584
+ }
104585
+ function visitCaseBlock(node) {
104586
+ return factory2.updateCaseBlock(
104587
+ node,
104588
+ visitNodes2(node.clauses, topLevelNestedVisitor, isCaseOrDefaultClause)
104402
104589
  );
104403
104590
  }
104591
+ function visitCaseClause(node) {
104592
+ return factory2.updateCaseClause(
104593
+ node,
104594
+ visitNode(node.expression, visitor, isExpression),
104595
+ visitNodes2(node.statements, topLevelNestedVisitor, isStatement)
104596
+ );
104597
+ }
104598
+ function visitDefaultClause(node) {
104599
+ return visitEachChild(node, topLevelNestedVisitor, context);
104600
+ }
104601
+ function visitTryStatement(node) {
104602
+ return visitEachChild(node, topLevelNestedVisitor, context);
104603
+ }
104604
+ function visitCatchClause(node) {
104605
+ return factory2.updateCatchClause(
104606
+ node,
104607
+ node.variableDeclaration,
104608
+ Debug.checkDefined(visitNode(node.block, topLevelNestedVisitor, isBlock))
104609
+ );
104610
+ }
104611
+ function visitBlock(node) {
104612
+ node = visitEachChild(node, topLevelNestedVisitor, context);
104613
+ return node;
104614
+ }
104404
104615
  function visitExpressionStatement(node) {
104405
104616
  return factory2.updateExpressionStatement(
104406
104617
  node,
@@ -105193,25 +105404,33 @@ ${lanes.join("\n")}
105193
105404
  return appendExportsOfDeclaration(statements, decl);
105194
105405
  }
105195
105406
  function appendExportsOfVariableStatement(statements, node) {
105407
+ return appendExportsOfVariableDeclarationList(
105408
+ statements,
105409
+ node.declarationList,
105410
+ /*isForInOrOfInitializer*/
105411
+ false
105412
+ );
105413
+ }
105414
+ function appendExportsOfVariableDeclarationList(statements, node, isForInOrOfInitializer) {
105196
105415
  if (currentModuleInfo.exportEquals) {
105197
105416
  return statements;
105198
105417
  }
105199
- for (const decl of node.declarationList.declarations) {
105200
- statements = appendExportsOfBindingElement(statements, decl);
105418
+ for (const decl of node.declarations) {
105419
+ statements = appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer);
105201
105420
  }
105202
105421
  return statements;
105203
105422
  }
105204
- function appendExportsOfBindingElement(statements, decl) {
105423
+ function appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer) {
105205
105424
  if (currentModuleInfo.exportEquals) {
105206
105425
  return statements;
105207
105426
  }
105208
105427
  if (isBindingPattern(decl.name)) {
105209
105428
  for (const element of decl.name.elements) {
105210
105429
  if (!isOmittedExpression(element)) {
105211
- statements = appendExportsOfBindingElement(statements, element);
105430
+ statements = appendExportsOfBindingElement(statements, element, isForInOrOfInitializer);
105212
105431
  }
105213
105432
  }
105214
- } else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer)) {
105433
+ } else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer || isForInOrOfInitializer)) {
105215
105434
  statements = appendExportsOfDeclaration(statements, decl);
105216
105435
  }
105217
105436
  return statements;
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-dev.20230427`;
57
+ var version = `${versionMajorMinor}.0-dev.20230428`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -10493,6 +10493,7 @@ function canHaveJSDoc(node) {
10493
10493
  case 171 /* PropertyDeclaration */:
10494
10494
  case 170 /* PropertySignature */:
10495
10495
  case 252 /* ReturnStatement */:
10496
+ case 239 /* SemicolonClassElement */:
10496
10497
  case 177 /* SetAccessor */:
10497
10498
  case 303 /* ShorthandPropertyAssignment */:
10498
10499
  case 304 /* SpreadAssignment */:
@@ -23138,11 +23139,11 @@ var Parser;
23138
23139
  }
23139
23140
  function parseClassElement() {
23140
23141
  const pos = getNodePos();
23142
+ const hasJSDoc = hasPrecedingJSDocComment();
23141
23143
  if (token() === 27 /* SemicolonToken */) {
23142
23144
  nextToken();
23143
- return finishNode(factory2.createSemicolonClassElement(), pos);
23145
+ return withJSDoc(finishNode(factory2.createSemicolonClassElement(), pos), hasJSDoc);
23144
23146
  }
23145
- const hasJSDoc = hasPrecedingJSDocComment();
23146
23147
  const modifiers = parseModifiers(
23147
23148
  /*allowDecorators*/
23148
23149
  true,
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.1.0-dev.20230427",
5
+ "version": "5.1.0-dev.20230428",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "14.21.1",
116
116
  "npm": "8.19.3"
117
117
  },
118
- "gitHead": "157753520520fd0936bff280de30af56e15f94ee"
118
+ "gitHead": "9a52f943ef2b8136e988954c20920a892e5fa992"
119
119
  }