typescript 4.3.1-rc → 4.3.5

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/tsserver.js CHANGED
@@ -96,7 +96,7 @@ var ts;
96
96
  // The following is baselined as a literal template type without intervention
97
97
  /** The version of the TypeScript compiler release */
98
98
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
99
- ts.version = "4.3.1-rc";
99
+ ts.version = "4.3.5";
100
100
  /* @internal */
101
101
  var Comparison;
102
102
  (function (Comparison) {
@@ -7689,7 +7689,7 @@ var ts;
7689
7689
  Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
7690
7690
  _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
7691
7691
  A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."),
7692
- The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."),
7692
+ The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."),
7693
7693
  Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
7694
7694
  Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
7695
7695
  An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."),
@@ -17321,56 +17321,43 @@ var ts;
17321
17321
  }
17322
17322
  return __assign(__assign({}, writer), { writeTrailingSemicolon: function () {
17323
17323
  pendingTrailingSemicolon = true;
17324
- },
17325
- writeLiteral: function (s) {
17324
+ }, writeLiteral: function (s) {
17326
17325
  commitPendingTrailingSemicolon();
17327
17326
  writer.writeLiteral(s);
17328
- },
17329
- writeStringLiteral: function (s) {
17327
+ }, writeStringLiteral: function (s) {
17330
17328
  commitPendingTrailingSemicolon();
17331
17329
  writer.writeStringLiteral(s);
17332
- },
17333
- writeSymbol: function (s, sym) {
17330
+ }, writeSymbol: function (s, sym) {
17334
17331
  commitPendingTrailingSemicolon();
17335
17332
  writer.writeSymbol(s, sym);
17336
- },
17337
- writePunctuation: function (s) {
17333
+ }, writePunctuation: function (s) {
17338
17334
  commitPendingTrailingSemicolon();
17339
17335
  writer.writePunctuation(s);
17340
- },
17341
- writeKeyword: function (s) {
17336
+ }, writeKeyword: function (s) {
17342
17337
  commitPendingTrailingSemicolon();
17343
17338
  writer.writeKeyword(s);
17344
- },
17345
- writeOperator: function (s) {
17339
+ }, writeOperator: function (s) {
17346
17340
  commitPendingTrailingSemicolon();
17347
17341
  writer.writeOperator(s);
17348
- },
17349
- writeParameter: function (s) {
17342
+ }, writeParameter: function (s) {
17350
17343
  commitPendingTrailingSemicolon();
17351
17344
  writer.writeParameter(s);
17352
- },
17353
- writeSpace: function (s) {
17345
+ }, writeSpace: function (s) {
17354
17346
  commitPendingTrailingSemicolon();
17355
17347
  writer.writeSpace(s);
17356
- },
17357
- writeProperty: function (s) {
17348
+ }, writeProperty: function (s) {
17358
17349
  commitPendingTrailingSemicolon();
17359
17350
  writer.writeProperty(s);
17360
- },
17361
- writeComment: function (s) {
17351
+ }, writeComment: function (s) {
17362
17352
  commitPendingTrailingSemicolon();
17363
17353
  writer.writeComment(s);
17364
- },
17365
- writeLine: function () {
17354
+ }, writeLine: function () {
17366
17355
  commitPendingTrailingSemicolon();
17367
17356
  writer.writeLine();
17368
- },
17369
- increaseIndent: function () {
17357
+ }, increaseIndent: function () {
17370
17358
  commitPendingTrailingSemicolon();
17371
17359
  writer.increaseIndent();
17372
- },
17373
- decreaseIndent: function () {
17360
+ }, decreaseIndent: function () {
17374
17361
  commitPendingTrailingSemicolon();
17375
17362
  writer.decreaseIndent();
17376
17363
  } });
@@ -29268,8 +29255,8 @@ var ts;
29268
29255
  visitNode(cbNode, node.typeExpression) ||
29269
29256
  (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
29270
29257
  : visitNode(cbNode, node.typeExpression) ||
29271
- visitNode(cbNode, node.name)) ||
29272
- (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
29258
+ visitNode(cbNode, node.name) ||
29259
+ (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)));
29273
29260
  case 320 /* JSDocAuthorTag */:
29274
29261
  return visitNode(cbNode, node.tagName) ||
29275
29262
  (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
@@ -30030,23 +30017,20 @@ var ts;
30030
30017
  return inContext(32768 /* AwaitContext */);
30031
30018
  }
30032
30019
  function parseErrorAtCurrentToken(message, arg0) {
30033
- return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
30020
+ parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
30034
30021
  }
30035
30022
  function parseErrorAtPosition(start, length, message, arg0) {
30036
30023
  // Don't report another error if it would just be at the same position as the last error.
30037
30024
  var lastError = ts.lastOrUndefined(parseDiagnostics);
30038
- var result;
30039
30025
  if (!lastError || start !== lastError.start) {
30040
- result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
30041
- parseDiagnostics.push(result);
30026
+ parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0));
30042
30027
  }
30043
30028
  // Mark that we've encountered an error. We'll set an appropriate bit on the next
30044
30029
  // node we finish so that it can't be reused incrementally.
30045
30030
  parseErrorBeforeNextFinishedNode = true;
30046
- return result;
30047
30031
  }
30048
30032
  function parseErrorAt(start, end, message, arg0) {
30049
- return parseErrorAtPosition(start, end - start, message, arg0);
30033
+ parseErrorAtPosition(start, end - start, message, arg0);
30050
30034
  }
30051
30035
  function parseErrorAtRange(range, message, arg0) {
30052
30036
  parseErrorAt(range.pos, range.end, message, arg0);
@@ -30203,16 +30187,6 @@ var ts;
30203
30187
  parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
30204
30188
  return false;
30205
30189
  }
30206
- function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) {
30207
- if (token() === closeKind) {
30208
- nextToken();
30209
- return;
30210
- }
30211
- var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
30212
- if (lastError) {
30213
- ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind)));
30214
- }
30215
- }
30216
30190
  function parseOptional(t) {
30217
30191
  if (token() === t) {
30218
30192
  nextToken();
@@ -33580,11 +33554,10 @@ var ts;
33580
33554
  }
33581
33555
  function parseArrayLiteralExpression() {
33582
33556
  var pos = getNodePos();
33583
- var openBracketPosition = scanner.getTokenPos();
33584
33557
  parseExpected(22 /* OpenBracketToken */);
33585
33558
  var multiLine = scanner.hasPrecedingLineBreak();
33586
33559
  var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
33587
- parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketPosition);
33560
+ parseExpected(23 /* CloseBracketToken */);
33588
33561
  return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
33589
33562
  }
33590
33563
  function parseObjectLiteralElement() {
@@ -33644,7 +33617,12 @@ var ts;
33644
33617
  parseExpected(18 /* OpenBraceToken */);
33645
33618
  var multiLine = scanner.hasPrecedingLineBreak();
33646
33619
  var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);
33647
- parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition);
33620
+ if (!parseExpected(19 /* CloseBraceToken */)) {
33621
+ var lastError = ts.lastOrUndefined(parseDiagnostics);
33622
+ if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
33623
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
33624
+ }
33625
+ }
33648
33626
  return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
33649
33627
  }
33650
33628
  function parseFunctionExpression() {
@@ -33718,7 +33696,12 @@ var ts;
33718
33696
  if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
33719
33697
  var multiLine = scanner.hasPrecedingLineBreak();
33720
33698
  var statements = parseList(1 /* BlockStatements */, parseStatement);
33721
- parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition);
33699
+ if (!parseExpected(19 /* CloseBraceToken */)) {
33700
+ var lastError = ts.lastOrUndefined(parseDiagnostics);
33701
+ if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
33702
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
33703
+ }
33704
+ }
33722
33705
  var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
33723
33706
  if (token() === 62 /* EqualsToken */) {
33724
33707
  parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
@@ -33763,10 +33746,9 @@ var ts;
33763
33746
  var pos = getNodePos();
33764
33747
  var hasJSDoc = hasPrecedingJSDocComment();
33765
33748
  parseExpected(98 /* IfKeyword */);
33766
- var openParenPosition = scanner.getTokenPos();
33767
33749
  parseExpected(20 /* OpenParenToken */);
33768
33750
  var expression = allowInAnd(parseExpression);
33769
- parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition);
33751
+ parseExpected(21 /* CloseParenToken */);
33770
33752
  var thenStatement = parseStatement();
33771
33753
  var elseStatement = parseOptional(90 /* ElseKeyword */) ? parseStatement() : undefined;
33772
33754
  return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
@@ -33777,10 +33759,9 @@ var ts;
33777
33759
  parseExpected(89 /* DoKeyword */);
33778
33760
  var statement = parseStatement();
33779
33761
  parseExpected(114 /* WhileKeyword */);
33780
- var openParenPosition = scanner.getTokenPos();
33781
33762
  parseExpected(20 /* OpenParenToken */);
33782
33763
  var expression = allowInAnd(parseExpression);
33783
- parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition);
33764
+ parseExpected(21 /* CloseParenToken */);
33784
33765
  // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
33785
33766
  // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
33786
33767
  // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby
@@ -33792,10 +33773,9 @@ var ts;
33792
33773
  var pos = getNodePos();
33793
33774
  var hasJSDoc = hasPrecedingJSDocComment();
33794
33775
  parseExpected(114 /* WhileKeyword */);
33795
- var openParenPosition = scanner.getTokenPos();
33796
33776
  parseExpected(20 /* OpenParenToken */);
33797
33777
  var expression = allowInAnd(parseExpression);
33798
- parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition);
33778
+ parseExpected(21 /* CloseParenToken */);
33799
33779
  var statement = parseStatement();
33800
33780
  return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
33801
33781
  }
@@ -33862,10 +33842,9 @@ var ts;
33862
33842
  var pos = getNodePos();
33863
33843
  var hasJSDoc = hasPrecedingJSDocComment();
33864
33844
  parseExpected(115 /* WithKeyword */);
33865
- var openParenPosition = scanner.getTokenPos();
33866
33845
  parseExpected(20 /* OpenParenToken */);
33867
33846
  var expression = allowInAnd(parseExpression);
33868
- parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition);
33847
+ parseExpected(21 /* CloseParenToken */);
33869
33848
  var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
33870
33849
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
33871
33850
  }
@@ -35856,7 +35835,8 @@ var ts;
35856
35835
  hasChildren = true;
35857
35836
  if (child.kind === 333 /* JSDocTypeTag */) {
35858
35837
  if (childTypeTag) {
35859
- var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
35838
+ parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
35839
+ var lastError = ts.lastOrUndefined(parseDiagnostics);
35860
35840
  if (lastError) {
35861
35841
  ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
35862
35842
  }
@@ -37389,6 +37369,8 @@ var ts;
37389
37369
  {
37390
37370
  name: "strict",
37391
37371
  type: "boolean",
37372
+ // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
37373
+ // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
37392
37374
  showInSimplifiedHelpView: true,
37393
37375
  category: ts.Diagnostics.Strict_Type_Checking_Options,
37394
37376
  description: ts.Diagnostics.Enable_all_strict_type_checking_options
@@ -40310,9 +40292,7 @@ var ts;
40310
40292
  var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
40311
40293
  moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
40312
40294
  var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
40313
- return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName,
40314
- clear: clear,
40315
- update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
40295
+ return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
40316
40296
  function clear() {
40317
40297
  preDirectoryResolutionCache.clear();
40318
40298
  moduleNameToDirectoryMap.clear();
@@ -56017,6 +55997,10 @@ var ts;
56017
55997
  var indexSymbol = symbol && getIndexSymbol(symbol);
56018
55998
  return indexSymbol && getIndexDeclarationOfIndexSymbol(indexSymbol, kind);
56019
55999
  }
56000
+ function getIndexDeclarationOfSymbolTable(symbolTable, kind) {
56001
+ var indexSymbol = symbolTable && getIndexSymbolFromSymbolTable(symbolTable);
56002
+ return indexSymbol && getIndexDeclarationOfIndexSymbol(indexSymbol, kind);
56003
+ }
56020
56004
  function getIndexDeclarationOfIndexSymbol(indexSymbol, kind) {
56021
56005
  var syntaxKind = kind === 1 /* Number */ ? 144 /* NumberKeyword */ : 147 /* StringKeyword */;
56022
56006
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
@@ -59171,8 +59155,7 @@ var ts;
59171
59155
  return type;
59172
59156
  }
59173
59157
  function maybeTypeParameterReference(node) {
59174
- return !(node.kind === 158 /* QualifiedName */ ||
59175
- node.parent.kind === 174 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
59158
+ return !(node.parent.kind === 174 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
59176
59159
  node.parent.kind === 196 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier);
59177
59160
  }
59178
59161
  function isTypeParameterPossiblyReferenced(tp, node) {
@@ -59200,7 +59183,10 @@ var ts;
59200
59183
  return true;
59201
59184
  case 166 /* MethodDeclaration */:
59202
59185
  case 165 /* MethodSignature */:
59203
- return (!node.type && !!node.body) || !!ts.forEachChild(node, containsReference);
59186
+ return !node.type && !!node.body ||
59187
+ ts.some(node.typeParameters, containsReference) ||
59188
+ ts.some(node.parameters, containsReference) ||
59189
+ !!node.type && containsReference(node.type);
59204
59190
  }
59205
59191
  return !!ts.forEachChild(node, containsReference);
59206
59192
  }
@@ -63225,14 +63211,17 @@ var ts;
63225
63211
  return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, undefinedType]);
63226
63212
  }
63227
63213
  function getGlobalNonNullableTypeInstantiation(type) {
63214
+ // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
63215
+ // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
63216
+ // that isn't eliminated by a NonNullable<T> instantiation.
63217
+ var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
63228
63218
  if (!deferredGlobalNonNullableTypeAlias) {
63229
63219
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
63230
63220
  }
63231
- // Use NonNullable global type alias if available to improve quick info/declaration emit
63232
- if (deferredGlobalNonNullableTypeAlias !== unknownSymbol) {
63233
- return getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]);
63234
- }
63235
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */); // Type alias unavailable, fall back to non-higher-order behavior
63221
+ // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
63222
+ return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
63223
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
63224
+ reducedType;
63236
63225
  }
63237
63226
  function getNonNullableType(type) {
63238
63227
  return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
@@ -64580,12 +64569,14 @@ var ts;
64580
64569
  applyToReturnTypes(source, target, inferFromTypes);
64581
64570
  }
64582
64571
  function inferFromIndexTypes(source, target) {
64572
+ // Inferences across mapped type index signatures are pretty much the same a inferences to homomorphic variables
64573
+ var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
64583
64574
  var targetStringIndexType = getIndexTypeOfType(target, 0 /* String */);
64584
64575
  if (targetStringIndexType) {
64585
64576
  var sourceIndexType = getIndexTypeOfType(source, 0 /* String */) ||
64586
64577
  getImplicitIndexTypeOfType(source, 0 /* String */);
64587
64578
  if (sourceIndexType) {
64588
- inferFromTypes(sourceIndexType, targetStringIndexType);
64579
+ inferWithPriority(sourceIndexType, targetStringIndexType, priority);
64589
64580
  }
64590
64581
  }
64591
64582
  var targetNumberIndexType = getIndexTypeOfType(target, 1 /* Number */);
@@ -64594,7 +64585,7 @@ var ts;
64594
64585
  getIndexTypeOfType(source, 0 /* String */) ||
64595
64586
  getImplicitIndexTypeOfType(source, 1 /* Number */);
64596
64587
  if (sourceIndexType) {
64597
- inferFromTypes(sourceIndexType, targetNumberIndexType);
64588
+ inferWithPriority(sourceIndexType, targetNumberIndexType, priority);
64598
64589
  }
64599
64590
  }
64600
64591
  }
@@ -66820,7 +66811,7 @@ var ts;
66820
66811
  !isGenericIndexType(getTypeOfExpression(parent.argumentExpression));
66821
66812
  }
66822
66813
  function isGenericTypeWithUnionConstraint(type) {
66823
- return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & 1048576 /* Union */);
66814
+ return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
66824
66815
  }
66825
66816
  function containsGenericType(type) {
66826
66817
  return !!(type.flags & 465829888 /* Instantiable */ || type.flags & 3145728 /* UnionOrIntersection */ && ts.some(type.types, containsGenericType));
@@ -78294,21 +78285,24 @@ var ts;
78294
78285
  checkBlock(node.finallyBlock);
78295
78286
  }
78296
78287
  }
78297
- function checkIndexConstraints(type) {
78298
- var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1 /* Number */);
78299
- var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0 /* String */);
78288
+ function checkIndexConstraints(type, isStatic) {
78289
+ var _a, _b, _c, _d;
78290
+ var declaredNumberIndexer = getIndexDeclarationOfSymbolTable(isStatic ? (_a = type.symbol) === null || _a === void 0 ? void 0 : _a.exports : (_b = type.symbol) === null || _b === void 0 ? void 0 : _b.members, 1 /* Number */);
78291
+ var declaredStringIndexer = getIndexDeclarationOfSymbolTable(isStatic ? (_c = type.symbol) === null || _c === void 0 ? void 0 : _c.exports : (_d = type.symbol) === null || _d === void 0 ? void 0 : _d.members, 0 /* String */);
78300
78292
  var stringIndexType = getIndexTypeOfType(type, 0 /* String */);
78301
78293
  var numberIndexType = getIndexTypeOfType(type, 1 /* Number */);
78302
78294
  if (stringIndexType || numberIndexType) {
78303
78295
  ts.forEach(getPropertiesOfObjectType(type), function (prop) {
78296
+ if (isStatic && prop.flags & 4194304 /* Prototype */)
78297
+ return;
78304
78298
  var propType = getTypeOfSymbol(prop);
78305
78299
  checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */);
78306
78300
  checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */);
78307
78301
  });
78308
78302
  var classDeclaration = type.symbol.valueDeclaration;
78309
78303
  if (ts.getObjectFlags(type) & 1 /* Class */ && classDeclaration && ts.isClassLike(classDeclaration)) {
78310
- for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) {
78311
- var member = _a[_i];
78304
+ for (var _i = 0, _e = classDeclaration.members; _i < _e.length; _i++) {
78305
+ var member = _e[_i];
78312
78306
  // Only process instance properties with computed names here.
78313
78307
  // Static properties cannot be in conflict with indexers,
78314
78308
  // and properties with literal names were already checked.
@@ -78638,7 +78632,7 @@ var ts;
78638
78632
  }
78639
78633
  if (produceDiagnostics) {
78640
78634
  checkIndexConstraints(type);
78641
- checkIndexConstraints(staticType);
78635
+ checkIndexConstraints(staticType, /*isStatic*/ true);
78642
78636
  checkTypeForDuplicateIndexSignatures(node);
78643
78637
  checkPropertyInitialization(node);
78644
78638
  }
@@ -85907,6 +85901,7 @@ var ts;
85907
85901
  case 120 /* PrivateKeyword */:
85908
85902
  case 121 /* ProtectedKeyword */:
85909
85903
  case 125 /* AbstractKeyword */:
85904
+ case 156 /* OverrideKeyword */:
85910
85905
  case 84 /* ConstKeyword */:
85911
85906
  case 133 /* DeclareKeyword */:
85912
85907
  case 142 /* ReadonlyKeyword */:
@@ -88697,10 +88692,11 @@ var ts;
88697
88692
  return ts.visitEachChild(node, visitor, context);
88698
88693
  }
88699
88694
  var staticProperties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true);
88695
+ var pendingPrivateStateAssignment;
88700
88696
  if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) {
88701
88697
  var temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true);
88702
88698
  getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp);
88703
- getPendingExpressions().push(factory.createAssignment(temp, factory.getInternalName(node)));
88699
+ pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node));
88704
88700
  }
88705
88701
  var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
88706
88702
  var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103 /* NullKeyword */);
@@ -88709,6 +88705,9 @@ var ts;
88709
88705
  /*decorators*/ undefined, node.modifiers, node.name,
88710
88706
  /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass))
88711
88707
  ];
88708
+ if (pendingPrivateStateAssignment) {
88709
+ getPendingExpressions().unshift(pendingPrivateStateAssignment);
88710
+ }
88712
88711
  // Write any pending expressions from elided or moved computed property names
88713
88712
  if (ts.some(pendingExpressions)) {
88714
88713
  statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
@@ -107095,11 +107094,21 @@ var ts;
107095
107094
  // JsxText will be written with its leading whitespace, so don't add more manually.
107096
107095
  return 0;
107097
107096
  }
107098
- else if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
107099
- return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
107100
- }
107101
- else if (!preserveSourceNewlines && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
107102
- return ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1;
107097
+ else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
107098
+ if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
107099
+ return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
107100
+ }
107101
+ // If `preserveSourceNewlines` is `false` we do not intend to preserve the effective lines between the
107102
+ // previous and next node. Instead we naively check whether nodes are on separate lines within the
107103
+ // same node parent. If so, we intend to preserve a single line terminator. This is less precise and
107104
+ // expensive than checking with `preserveSourceNewlines` as above, but the goal is not to preserve the
107105
+ // effective source lines between two sibling nodes.
107106
+ else if (!preserveSourceNewlines && originalNodesHaveSameParent(previousNode, nextNode)) {
107107
+ return ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1;
107108
+ }
107109
+ // If the two nodes are not comparable, add a line terminator based on the format that can indicate
107110
+ // whether new lines are preferred or not.
107111
+ return format & 65536 /* PreferNewLine */ ? 1 : 0;
107103
107112
  }
107104
107113
  else if (synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format)) {
107105
107114
  return 1;
@@ -107739,10 +107748,13 @@ var ts;
107739
107748
  }
107740
107749
  exitComment();
107741
107750
  }
107751
+ function originalNodesHaveSameParent(nodeA, nodeB) {
107752
+ nodeA = ts.getOriginalNode(nodeA);
107753
+ // For performance, do not call `getOriginalNode` for `nodeB` if `nodeA` doesn't even
107754
+ // have a parent node.
107755
+ return nodeA.parent && nodeA.parent === ts.getOriginalNode(nodeB).parent;
107756
+ }
107742
107757
  function siblingNodePositionsAreComparable(previousNode, nextNode) {
107743
- if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) {
107744
- return false;
107745
- }
107746
107758
  if (nextNode.pos < previousNode.end) {
107747
107759
  return false;
107748
107760
  }
@@ -113115,8 +113127,14 @@ var ts;
113115
113127
  var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
113116
113128
  for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
113117
113129
  var name = _a[_i];
113118
- var optionInfo = optionsNameMap.get(name.toLowerCase());
113119
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) || name === "skipLibCheck" || name === "skipDefaultLibCheck") {
113130
+ var optionKey = name.toLowerCase();
113131
+ var optionInfo = optionsNameMap.get(optionKey);
113132
+ if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
113133
+ // We need to store `strict`, even though it won't be examined directly, so that the
113134
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
113135
+ optionKey === "strict" ||
113136
+ // We need to store these to determine whether `lib` files need to be rechecked.
113137
+ optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
113120
113138
  (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
113121
113139
  }
113122
113140
  }
@@ -116625,7 +116643,7 @@ var ts;
116625
116643
  },
116626
116644
  emit: function (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
116627
116645
  if (targetSourceFile || emitOnlyDtsFiles) {
116628
- return withProgramOrUndefined(function (program) { return program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); });
116646
+ return withProgramOrUndefined(function (program) { var _a, _b; return program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project))); });
116629
116647
  }
116630
116648
  executeSteps(BuildStep.SemanticDiagnostics, cancellationToken);
116631
116649
  if (step === BuildStep.EmitBuildInfo) {
@@ -116710,6 +116728,7 @@ var ts;
116710
116728
  }
116711
116729
  function emit(writeFileCallback, cancellationToken, customTransformers) {
116712
116730
  var _a;
116731
+ var _b, _c;
116713
116732
  ts.Debug.assertIsDefined(program);
116714
116733
  ts.Debug.assert(step === BuildStep.Emit);
116715
116734
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
@@ -116720,7 +116739,7 @@ var ts;
116720
116739
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
116721
116740
  /*write*/ undefined,
116722
116741
  /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
116723
- /*emitOnlyDts*/ false, customTransformers).emitResult;
116742
+ /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
116724
116743
  // Don't emit .d.ts if there are decl file errors
116725
116744
  if (declDiagnostics) {
116726
116745
  program.restoreState();
@@ -116802,6 +116821,7 @@ var ts;
116802
116821
  return emitDiagnostics;
116803
116822
  }
116804
116823
  function emitBundle(writeFileCallback, customTransformers) {
116824
+ var _a, _b;
116805
116825
  ts.Debug.assert(kind === InvalidatedProjectKind.UpdateBundle);
116806
116826
  if (state.options.dry) {
116807
116827
  reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
@@ -116817,7 +116837,7 @@ var ts;
116817
116837
  var outputFiles = ts.emitUsingBuildInfo(config, compilerHost, function (ref) {
116818
116838
  var refName = resolveProjectName(state, ref.path);
116819
116839
  return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
116820
- }, customTransformers);
116840
+ }, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project)));
116821
116841
  if (ts.isString(outputFiles)) {
116822
116842
  reportStatus(state, ts.Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
116823
116843
  step = BuildStep.BuildInvalidatedProjectOfBundle;
@@ -120710,9 +120730,7 @@ var ts;
120710
120730
  [8 /* OptionalDependencies */, info.optionalDependencies],
120711
120731
  [4 /* PeerDependencies */, info.peerDependencies],
120712
120732
  ];
120713
- return __assign(__assign({}, info), { parseable: !!content, fileName: fileName,
120714
- get: get,
120715
- has: function (dependencyName, inGroups) {
120733
+ return __assign(__assign({}, info), { parseable: !!content, fileName: fileName, get: get, has: function (dependencyName, inGroups) {
120716
120734
  return !!get(dependencyName, inGroups);
120717
120735
  } });
120718
120736
  function get(dependencyName, inGroups) {
@@ -123168,6 +123186,8 @@ var ts;
123168
123186
  return jsdocCompletionInfo(ts.JsDoc.getJSDocTagCompletions());
123169
123187
  case 3 /* JsDocParameterName */:
123170
123188
  return jsdocCompletionInfo(ts.JsDoc.getJSDocParameterNameCompletions(completionData.tag));
123189
+ case 4 /* Keywords */:
123190
+ return specificKeywordCompletionInfo(completionData.keywords);
123171
123191
  default:
123172
123192
  return ts.Debug.assertNever(completionData);
123173
123193
  }
@@ -123176,6 +123196,19 @@ var ts;
123176
123196
  function jsdocCompletionInfo(entries) {
123177
123197
  return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries };
123178
123198
  }
123199
+ function specificKeywordCompletionInfo(keywords) {
123200
+ return {
123201
+ isGlobalCompletion: false,
123202
+ isMemberCompletion: false,
123203
+ isNewIdentifierLocation: false,
123204
+ entries: keywords.map(function (k) { return ({
123205
+ name: ts.tokenToString(k),
123206
+ kind: "keyword" /* keyword */,
123207
+ kindModifiers: "" /* none */,
123208
+ sortText: SortText.GlobalsOrKeywords,
123209
+ }); }),
123210
+ };
123211
+ }
123179
123212
  function getOptionalReplacementSpan(location) {
123180
123213
  // StringLiteralLike locations are handled separately in stringCompletions.ts
123181
123214
  return (location === null || location === void 0 ? void 0 : location.kind) === 78 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
@@ -123600,6 +123633,8 @@ var ts;
123600
123633
  return ts.JsDoc.getJSDocTagCompletionDetails(name);
123601
123634
  case 3 /* JsDocParameterName */:
123602
123635
  return ts.JsDoc.getJSDocParameterNameCompletionDetails(name);
123636
+ case 4 /* Keywords */:
123637
+ return request.keywords.indexOf(ts.stringToToken(name)) > -1 ? createSimpleDetails(name, "keyword" /* keyword */, ts.SymbolDisplayPartKind.keyword) : undefined;
123603
123638
  default:
123604
123639
  return ts.Debug.assertNever(request);
123605
123640
  }
@@ -123658,6 +123693,7 @@ var ts;
123658
123693
  CompletionDataKind[CompletionDataKind["JsDocTagName"] = 1] = "JsDocTagName";
123659
123694
  CompletionDataKind[CompletionDataKind["JsDocTag"] = 2] = "JsDocTag";
123660
123695
  CompletionDataKind[CompletionDataKind["JsDocParameterName"] = 3] = "JsDocParameterName";
123696
+ CompletionDataKind[CompletionDataKind["Keywords"] = 4] = "Keywords";
123661
123697
  })(CompletionDataKind || (CompletionDataKind = {}));
123662
123698
  var CompletionKind;
123663
123699
  (function (CompletionKind) {
@@ -123818,13 +123854,17 @@ var ts;
123818
123854
  var importCompletionNode;
123819
123855
  var location = ts.getTouchingPropertyName(sourceFile, position);
123820
123856
  if (contextToken) {
123857
+ var importCompletionCandidate = getImportCompletionNode(contextToken);
123858
+ if (importCompletionCandidate === 153 /* FromKeyword */) {
123859
+ return { kind: 4 /* Keywords */, keywords: [153 /* FromKeyword */] };
123860
+ }
123821
123861
  // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
123822
123862
  // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
123823
123863
  // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
123824
123864
  // to opt in with the `includeCompletionsForImportStatements` user preference.
123825
- importCompletionNode = preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText
123826
- ? getImportCompletionNode(contextToken)
123827
- : undefined;
123865
+ if (importCompletionCandidate && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
123866
+ importCompletionNode = importCompletionCandidate;
123867
+ }
123828
123868
  // Bail out if this is a known invalid completion location
123829
123869
  if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
123830
123870
  log("Returning an empty list because completion was requested in an invalid position.");
@@ -123957,10 +123997,9 @@ var ts;
123957
123997
  getTypeScriptMemberSymbols();
123958
123998
  }
123959
123999
  else if (isRightOfOpenTag) {
123960
- var tagSymbols = typeChecker.getJsxIntrinsicTagNamesAt(location);
123961
- ts.Debug.assertEachIsDefined(tagSymbols, "getJsxIntrinsicTagNames() should all be defined");
124000
+ symbols = typeChecker.getJsxIntrinsicTagNamesAt(location);
124001
+ ts.Debug.assertEachIsDefined(symbols, "getJsxIntrinsicTagNames() should all be defined");
123962
124002
  tryGetGlobalSymbols();
123963
- symbols = tagSymbols.concat(symbols);
123964
124003
  completionKind = 1 /* Global */;
123965
124004
  keywordFilters = 0 /* None */;
123966
124005
  }
@@ -124225,7 +124264,7 @@ var ts;
124225
124264
  if (!attrsType)
124226
124265
  return 0 /* Continue */;
124227
124266
  var completionsType = jsxContainer && typeChecker.getContextualType(jsxContainer.attributes, 4 /* Completions */);
124228
- symbols = filterJsxAttributes(getPropertiesForObjectExpression(attrsType, completionsType, jsxContainer.attributes, typeChecker), jsxContainer.attributes.properties);
124267
+ symbols = ts.concatenate(symbols, filterJsxAttributes(getPropertiesForObjectExpression(attrsType, completionsType, jsxContainer.attributes, typeChecker), jsxContainer.attributes.properties));
124229
124268
  setSortTextToOptionalMember();
124230
124269
  completionKind = 3 /* MemberLike */;
124231
124270
  isNewIdentifierLocation = false;
@@ -124276,7 +124315,7 @@ var ts;
124276
124315
  var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
124277
124316
  isInSnippetScope = isSnippetScope(scopeNode);
124278
124317
  var symbolMeanings = (isTypeOnly ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
124279
- symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings);
124318
+ symbols = ts.concatenate(symbols, typeChecker.getSymbolsInScope(scopeNode, symbolMeanings));
124280
124319
  ts.Debug.assertEachIsDefined(symbols, "getSymbolsInScope() should all be defined");
124281
124320
  for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
124282
124321
  var symbol = symbols_1[_i];
@@ -124576,7 +124615,7 @@ var ts;
124576
124615
  var existingMembers = getPropertiesForCompletion(containerActualType, typeChecker);
124577
124616
  var existingMemberEscapedNames = new ts.Set();
124578
124617
  existingMembers.forEach(function (s) { return existingMemberEscapedNames.add(s.escapedName); });
124579
- symbols = ts.filter(members, function (s) { return !existingMemberEscapedNames.has(s.escapedName); });
124618
+ symbols = ts.concatenate(symbols, ts.filter(members, function (s) { return !existingMemberEscapedNames.has(s.escapedName); }));
124580
124619
  completionKind = 0 /* ObjectPropertyDeclaration */;
124581
124620
  isNewIdentifierLocation = true;
124582
124621
  return 1 /* Success */;
@@ -124658,7 +124697,7 @@ var ts;
124658
124697
  }
124659
124698
  if (typeMembers && typeMembers.length > 0) {
124660
124699
  // Add filtered items to the completion list
124661
- symbols = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers));
124700
+ symbols = ts.concatenate(symbols, filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)));
124662
124701
  }
124663
124702
  setSortTextToOptionalMember();
124664
124703
  return 1 /* Success */;
@@ -124693,7 +124732,7 @@ var ts;
124693
124732
  isNewIdentifierLocation = false;
124694
124733
  var exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
124695
124734
  var existing = new ts.Set(namedImportsOrExports.elements.filter(function (n) { return !isCurrentlyEditingNode(n); }).map(function (n) { return (n.propertyName || n.name).escapedText; }));
124696
- symbols = exports.filter(function (e) { return e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName); });
124735
+ symbols = ts.concatenate(symbols, exports.filter(function (e) { return e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName); }));
124697
124736
  return 1 /* Success */;
124698
124737
  }
124699
124738
  /**
@@ -124768,7 +124807,7 @@ var ts;
124768
124807
  (type === null || type === void 0 ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) :
124769
124808
  type && typeChecker.getPropertiesOfType(type);
124770
124809
  });
124771
- symbols = filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags);
124810
+ symbols = ts.concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags));
124772
124811
  }
124773
124812
  return 1 /* Success */;
124774
124813
  }
@@ -125578,16 +125617,20 @@ var ts;
125578
125617
  }
125579
125618
  function getImportCompletionNode(contextToken) {
125580
125619
  var candidate = getCandidate();
125581
- return candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined;
125620
+ return candidate === 153 /* FromKeyword */ || candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined;
125582
125621
  function getCandidate() {
125583
125622
  var parent = contextToken.parent;
125584
125623
  if (ts.isImportEqualsDeclaration(parent)) {
125585
125624
  return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined;
125586
125625
  }
125587
125626
  if (ts.isNamedImports(parent) || ts.isNamespaceImport(parent)) {
125588
- return isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name
125589
- ? parent.parent.parent
125590
- : undefined;
125627
+ if (isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name) {
125628
+ // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from`
125629
+ return contextToken.kind === 19 /* CloseBraceToken */ || contextToken.kind === 78 /* Identifier */
125630
+ ? 153 /* FromKeyword */
125631
+ : parent.parent.parent;
125632
+ }
125633
+ return undefined;
125591
125634
  }
125592
125635
  if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) {
125593
125636
  // A lone import keyword with nothing following it does not parse as a statement at all
@@ -127112,9 +127155,7 @@ var ts;
127112
127155
  var name_1 = displayParts_1.map(function (p) { return p.text; }).join("");
127113
127156
  var declaration = symbol.declarations && ts.firstOrUndefined(symbol.declarations);
127114
127157
  var node = declaration ? (ts.getNameOfDeclaration(declaration) || declaration) : originalNode;
127115
- return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: name_1,
127116
- kind: kind_1,
127117
- displayParts: displayParts_1, context: getContextNode(declaration) });
127158
+ return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: name_1, kind: kind_1, displayParts: displayParts_1, context: getContextNode(declaration) });
127118
127159
  }
127119
127160
  case 1 /* Label */: {
127120
127161
  var node = def.node;
@@ -127149,10 +127190,7 @@ var ts;
127149
127190
  }
127150
127191
  })();
127151
127192
  var sourceFile = info.sourceFile, textSpan = info.textSpan, name = info.name, kind = info.kind, displayParts = info.displayParts, context = info.context;
127152
- return __assign({ containerKind: "" /* unknown */, containerName: "", fileName: sourceFile.fileName, kind: kind,
127153
- name: name,
127154
- textSpan: textSpan,
127155
- displayParts: displayParts }, toContextSpan(textSpan, sourceFile, context));
127193
+ return __assign({ containerKind: "" /* unknown */, containerName: "", fileName: sourceFile.fileName, kind: kind, name: name, textSpan: textSpan, displayParts: displayParts }, toContextSpan(textSpan, sourceFile, context));
127156
127194
  }
127157
127195
  function getFileAndTextSpanFromNode(node) {
127158
127196
  var sourceFile = node.getSourceFile();
@@ -165308,9 +165346,7 @@ var ts;
165308
165346
  var span = toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo);
165309
165347
  var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1);
165310
165348
  var lineText = scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, "");
165311
- return __assign(__assign({ file: fileName }, span), { lineText: lineText,
165312
- isWriteAccess: isWriteAccess,
165313
- isDefinition: isDefinition });
165349
+ return __assign(__assign({ file: fileName }, span), { lineText: lineText, isWriteAccess: isWriteAccess, isDefinition: isDefinition });
165314
165350
  }
165315
165351
  function isCompletionEntryData(data) {
165316
165352
  return data === undefined || data && typeof data === "object"
@@ -166242,10 +166278,8 @@ var ts;
166242
166278
  var WorkerSession = /** @class */ (function (_super) {
166243
166279
  __extends(WorkerSession, _super);
166244
166280
  function WorkerSession(host, webHost, options, logger, cancellationToken, hrtime) {
166245
- var _this = _super.call(this, __assign(__assign({ host: host,
166246
- cancellationToken: cancellationToken }, options), { typingsInstaller: server.nullTypingsInstaller, byteLength: ts.notImplemented, // Formats the message text in send of Session which is overriden in this class so not needed
166247
- hrtime: hrtime,
166248
- logger: logger, canUseEvents: false })) || this;
166281
+ var _this = _super.call(this, __assign(__assign({ host: host, cancellationToken: cancellationToken }, options), { typingsInstaller: server.nullTypingsInstaller, byteLength: ts.notImplemented, // Formats the message text in send of Session which is overriden in this class so not needed
166282
+ hrtime: hrtime, logger: logger, canUseEvents: false })) || this;
166249
166283
  _this.webHost = webHost;
166250
166284
  return _this;
166251
166285
  }
@@ -167746,8 +167780,7 @@ var ts;
167746
167780
  var typingsInstaller = disableAutomaticTypingAcquisition
167747
167781
  ? undefined
167748
167782
  : new NodeTypingsInstaller(telemetryEnabled, logger, host, getGlobalTypingsCacheLocation(), typingSafeListLocation, typesMapLocation, npmLocation, validateDefaultNpmLocation, event);
167749
- _this = _super.call(this, __assign(__assign({ host: host,
167750
- cancellationToken: cancellationToken }, options), { typingsInstaller: typingsInstaller || server.nullTypingsInstaller, byteLength: Buffer.byteLength, hrtime: process.hrtime, logger: logger, canUseEvents: true, typesMapLocation: typesMapLocation })) || this;
167783
+ _this = _super.call(this, __assign(__assign({ host: host, cancellationToken: cancellationToken }, options), { typingsInstaller: typingsInstaller || server.nullTypingsInstaller, byteLength: Buffer.byteLength, hrtime: process.hrtime, logger: logger, canUseEvents: true, typesMapLocation: typesMapLocation })) || this;
167751
167784
  _this.eventPort = eventPort;
167752
167785
  if (_this.canUseEvents && _this.eventPort) {
167753
167786
  var s_1 = net.connect({ port: _this.eventPort }, function () {