typescript 4.3.0-dev.20210510 → 4.3.4

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.
@@ -290,7 +290,7 @@ var ts;
290
290
  // The following is baselined as a literal template type without intervention
291
291
  /** The version of the TypeScript compiler release */
292
292
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
293
- ts.version = ts.versionMajorMinor + ".0-dev.20210510";
293
+ ts.version = "4.3.4";
294
294
  /* @internal */
295
295
  var Comparison;
296
296
  (function (Comparison) {
@@ -7883,7 +7883,7 @@ var ts;
7883
7883
  Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
7884
7884
  _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
7885
7885
  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."),
7886
- 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."),
7886
+ 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."),
7887
7887
  Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
7888
7888
  Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
7889
7889
  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."),
@@ -17515,56 +17515,43 @@ var ts;
17515
17515
  }
17516
17516
  return __assign(__assign({}, writer), { writeTrailingSemicolon: function () {
17517
17517
  pendingTrailingSemicolon = true;
17518
- },
17519
- writeLiteral: function (s) {
17518
+ }, writeLiteral: function (s) {
17520
17519
  commitPendingTrailingSemicolon();
17521
17520
  writer.writeLiteral(s);
17522
- },
17523
- writeStringLiteral: function (s) {
17521
+ }, writeStringLiteral: function (s) {
17524
17522
  commitPendingTrailingSemicolon();
17525
17523
  writer.writeStringLiteral(s);
17526
- },
17527
- writeSymbol: function (s, sym) {
17524
+ }, writeSymbol: function (s, sym) {
17528
17525
  commitPendingTrailingSemicolon();
17529
17526
  writer.writeSymbol(s, sym);
17530
- },
17531
- writePunctuation: function (s) {
17527
+ }, writePunctuation: function (s) {
17532
17528
  commitPendingTrailingSemicolon();
17533
17529
  writer.writePunctuation(s);
17534
- },
17535
- writeKeyword: function (s) {
17530
+ }, writeKeyword: function (s) {
17536
17531
  commitPendingTrailingSemicolon();
17537
17532
  writer.writeKeyword(s);
17538
- },
17539
- writeOperator: function (s) {
17533
+ }, writeOperator: function (s) {
17540
17534
  commitPendingTrailingSemicolon();
17541
17535
  writer.writeOperator(s);
17542
- },
17543
- writeParameter: function (s) {
17536
+ }, writeParameter: function (s) {
17544
17537
  commitPendingTrailingSemicolon();
17545
17538
  writer.writeParameter(s);
17546
- },
17547
- writeSpace: function (s) {
17539
+ }, writeSpace: function (s) {
17548
17540
  commitPendingTrailingSemicolon();
17549
17541
  writer.writeSpace(s);
17550
- },
17551
- writeProperty: function (s) {
17542
+ }, writeProperty: function (s) {
17552
17543
  commitPendingTrailingSemicolon();
17553
17544
  writer.writeProperty(s);
17554
- },
17555
- writeComment: function (s) {
17545
+ }, writeComment: function (s) {
17556
17546
  commitPendingTrailingSemicolon();
17557
17547
  writer.writeComment(s);
17558
- },
17559
- writeLine: function () {
17548
+ }, writeLine: function () {
17560
17549
  commitPendingTrailingSemicolon();
17561
17550
  writer.writeLine();
17562
- },
17563
- increaseIndent: function () {
17551
+ }, increaseIndent: function () {
17564
17552
  commitPendingTrailingSemicolon();
17565
17553
  writer.increaseIndent();
17566
- },
17567
- decreaseIndent: function () {
17554
+ }, decreaseIndent: function () {
17568
17555
  commitPendingTrailingSemicolon();
17569
17556
  writer.decreaseIndent();
17570
17557
  } });
@@ -29462,8 +29449,8 @@ var ts;
29462
29449
  visitNode(cbNode, node.typeExpression) ||
29463
29450
  (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
29464
29451
  : visitNode(cbNode, node.typeExpression) ||
29465
- visitNode(cbNode, node.name)) ||
29466
- (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
29452
+ visitNode(cbNode, node.name) ||
29453
+ (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)));
29467
29454
  case 320 /* JSDocAuthorTag */:
29468
29455
  return visitNode(cbNode, node.tagName) ||
29469
29456
  (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
@@ -30224,23 +30211,20 @@ var ts;
30224
30211
  return inContext(32768 /* AwaitContext */);
30225
30212
  }
30226
30213
  function parseErrorAtCurrentToken(message, arg0) {
30227
- return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
30214
+ parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
30228
30215
  }
30229
30216
  function parseErrorAtPosition(start, length, message, arg0) {
30230
30217
  // Don't report another error if it would just be at the same position as the last error.
30231
30218
  var lastError = ts.lastOrUndefined(parseDiagnostics);
30232
- var result;
30233
30219
  if (!lastError || start !== lastError.start) {
30234
- result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
30235
- parseDiagnostics.push(result);
30220
+ parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0));
30236
30221
  }
30237
30222
  // Mark that we've encountered an error. We'll set an appropriate bit on the next
30238
30223
  // node we finish so that it can't be reused incrementally.
30239
30224
  parseErrorBeforeNextFinishedNode = true;
30240
- return result;
30241
30225
  }
30242
30226
  function parseErrorAt(start, end, message, arg0) {
30243
- return parseErrorAtPosition(start, end - start, message, arg0);
30227
+ parseErrorAtPosition(start, end - start, message, arg0);
30244
30228
  }
30245
30229
  function parseErrorAtRange(range, message, arg0) {
30246
30230
  parseErrorAt(range.pos, range.end, message, arg0);
@@ -30397,16 +30381,6 @@ var ts;
30397
30381
  parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
30398
30382
  return false;
30399
30383
  }
30400
- function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) {
30401
- if (token() === closeKind) {
30402
- nextToken();
30403
- return;
30404
- }
30405
- var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
30406
- if (lastError) {
30407
- 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)));
30408
- }
30409
- }
30410
30384
  function parseOptional(t) {
30411
30385
  if (token() === t) {
30412
30386
  nextToken();
@@ -33774,11 +33748,10 @@ var ts;
33774
33748
  }
33775
33749
  function parseArrayLiteralExpression() {
33776
33750
  var pos = getNodePos();
33777
- var openBracketPosition = scanner.getTokenPos();
33778
33751
  parseExpected(22 /* OpenBracketToken */);
33779
33752
  var multiLine = scanner.hasPrecedingLineBreak();
33780
33753
  var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
33781
- parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketPosition);
33754
+ parseExpected(23 /* CloseBracketToken */);
33782
33755
  return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
33783
33756
  }
33784
33757
  function parseObjectLiteralElement() {
@@ -33838,7 +33811,12 @@ var ts;
33838
33811
  parseExpected(18 /* OpenBraceToken */);
33839
33812
  var multiLine = scanner.hasPrecedingLineBreak();
33840
33813
  var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);
33841
- parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition);
33814
+ if (!parseExpected(19 /* CloseBraceToken */)) {
33815
+ var lastError = ts.lastOrUndefined(parseDiagnostics);
33816
+ if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
33817
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
33818
+ }
33819
+ }
33842
33820
  return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
33843
33821
  }
33844
33822
  function parseFunctionExpression() {
@@ -33912,7 +33890,12 @@ var ts;
33912
33890
  if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
33913
33891
  var multiLine = scanner.hasPrecedingLineBreak();
33914
33892
  var statements = parseList(1 /* BlockStatements */, parseStatement);
33915
- parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition);
33893
+ if (!parseExpected(19 /* CloseBraceToken */)) {
33894
+ var lastError = ts.lastOrUndefined(parseDiagnostics);
33895
+ if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
33896
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
33897
+ }
33898
+ }
33916
33899
  var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
33917
33900
  if (token() === 62 /* EqualsToken */) {
33918
33901
  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);
@@ -33957,10 +33940,9 @@ var ts;
33957
33940
  var pos = getNodePos();
33958
33941
  var hasJSDoc = hasPrecedingJSDocComment();
33959
33942
  parseExpected(98 /* IfKeyword */);
33960
- var openParenPosition = scanner.getTokenPos();
33961
33943
  parseExpected(20 /* OpenParenToken */);
33962
33944
  var expression = allowInAnd(parseExpression);
33963
- parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition);
33945
+ parseExpected(21 /* CloseParenToken */);
33964
33946
  var thenStatement = parseStatement();
33965
33947
  var elseStatement = parseOptional(90 /* ElseKeyword */) ? parseStatement() : undefined;
33966
33948
  return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
@@ -33971,10 +33953,9 @@ var ts;
33971
33953
  parseExpected(89 /* DoKeyword */);
33972
33954
  var statement = parseStatement();
33973
33955
  parseExpected(114 /* WhileKeyword */);
33974
- var openParenPosition = scanner.getTokenPos();
33975
33956
  parseExpected(20 /* OpenParenToken */);
33976
33957
  var expression = allowInAnd(parseExpression);
33977
- parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition);
33958
+ parseExpected(21 /* CloseParenToken */);
33978
33959
  // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
33979
33960
  // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
33980
33961
  // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby
@@ -33986,10 +33967,9 @@ var ts;
33986
33967
  var pos = getNodePos();
33987
33968
  var hasJSDoc = hasPrecedingJSDocComment();
33988
33969
  parseExpected(114 /* WhileKeyword */);
33989
- var openParenPosition = scanner.getTokenPos();
33990
33970
  parseExpected(20 /* OpenParenToken */);
33991
33971
  var expression = allowInAnd(parseExpression);
33992
- parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition);
33972
+ parseExpected(21 /* CloseParenToken */);
33993
33973
  var statement = parseStatement();
33994
33974
  return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
33995
33975
  }
@@ -34056,10 +34036,9 @@ var ts;
34056
34036
  var pos = getNodePos();
34057
34037
  var hasJSDoc = hasPrecedingJSDocComment();
34058
34038
  parseExpected(115 /* WithKeyword */);
34059
- var openParenPosition = scanner.getTokenPos();
34060
34039
  parseExpected(20 /* OpenParenToken */);
34061
34040
  var expression = allowInAnd(parseExpression);
34062
- parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition);
34041
+ parseExpected(21 /* CloseParenToken */);
34063
34042
  var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
34064
34043
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
34065
34044
  }
@@ -36050,7 +36029,8 @@ var ts;
36050
36029
  hasChildren = true;
36051
36030
  if (child.kind === 333 /* JSDocTypeTag */) {
36052
36031
  if (childTypeTag) {
36053
- var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
36032
+ parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
36033
+ var lastError = ts.lastOrUndefined(parseDiagnostics);
36054
36034
  if (lastError) {
36055
36035
  ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
36056
36036
  }
@@ -37583,6 +37563,8 @@ var ts;
37583
37563
  {
37584
37564
  name: "strict",
37585
37565
  type: "boolean",
37566
+ // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
37567
+ // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
37586
37568
  showInSimplifiedHelpView: true,
37587
37569
  category: ts.Diagnostics.Strict_Type_Checking_Options,
37588
37570
  description: ts.Diagnostics.Enable_all_strict_type_checking_options
@@ -40504,9 +40486,7 @@ var ts;
40504
40486
  var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
40505
40487
  moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
40506
40488
  var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
40507
- return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName,
40508
- clear: clear,
40509
- update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
40489
+ return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
40510
40490
  function clear() {
40511
40491
  preDirectoryResolutionCache.clear();
40512
40492
  moduleNameToDirectoryMap.clear();
@@ -56211,6 +56191,10 @@ var ts;
56211
56191
  var indexSymbol = symbol && getIndexSymbol(symbol);
56212
56192
  return indexSymbol && getIndexDeclarationOfIndexSymbol(indexSymbol, kind);
56213
56193
  }
56194
+ function getIndexDeclarationOfSymbolTable(symbolTable, kind) {
56195
+ var indexSymbol = symbolTable && getIndexSymbolFromSymbolTable(symbolTable);
56196
+ return indexSymbol && getIndexDeclarationOfIndexSymbol(indexSymbol, kind);
56197
+ }
56214
56198
  function getIndexDeclarationOfIndexSymbol(indexSymbol, kind) {
56215
56199
  var syntaxKind = kind === 1 /* Number */ ? 144 /* NumberKeyword */ : 147 /* StringKeyword */;
56216
56200
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
@@ -59365,8 +59349,7 @@ var ts;
59365
59349
  return type;
59366
59350
  }
59367
59351
  function maybeTypeParameterReference(node) {
59368
- return !(node.kind === 158 /* QualifiedName */ ||
59369
- node.parent.kind === 174 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
59352
+ return !(node.parent.kind === 174 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName ||
59370
59353
  node.parent.kind === 196 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier);
59371
59354
  }
59372
59355
  function isTypeParameterPossiblyReferenced(tp, node) {
@@ -59394,7 +59377,10 @@ var ts;
59394
59377
  return true;
59395
59378
  case 166 /* MethodDeclaration */:
59396
59379
  case 165 /* MethodSignature */:
59397
- return (!node.type && !!node.body) || !!ts.forEachChild(node, containsReference);
59380
+ return !node.type && !!node.body ||
59381
+ ts.some(node.typeParameters, containsReference) ||
59382
+ ts.some(node.parameters, containsReference) ||
59383
+ !!node.type && containsReference(node.type);
59398
59384
  }
59399
59385
  return !!ts.forEachChild(node, containsReference);
59400
59386
  }
@@ -63419,14 +63405,17 @@ var ts;
63419
63405
  return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, undefinedType]);
63420
63406
  }
63421
63407
  function getGlobalNonNullableTypeInstantiation(type) {
63408
+ // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
63409
+ // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
63410
+ // that isn't eliminated by a NonNullable<T> instantiation.
63411
+ var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
63422
63412
  if (!deferredGlobalNonNullableTypeAlias) {
63423
63413
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
63424
63414
  }
63425
- // Use NonNullable global type alias if available to improve quick info/declaration emit
63426
- if (deferredGlobalNonNullableTypeAlias !== unknownSymbol) {
63427
- return getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]);
63428
- }
63429
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */); // Type alias unavailable, fall back to non-higher-order behavior
63415
+ // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
63416
+ return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
63417
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
63418
+ reducedType;
63430
63419
  }
63431
63420
  function getNonNullableType(type) {
63432
63421
  return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
@@ -64774,12 +64763,14 @@ var ts;
64774
64763
  applyToReturnTypes(source, target, inferFromTypes);
64775
64764
  }
64776
64765
  function inferFromIndexTypes(source, target) {
64766
+ // Inferences across mapped type index signatures are pretty much the same a inferences to homomorphic variables
64767
+ var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* Mapped */) ? 8 /* HomomorphicMappedType */ : 0;
64777
64768
  var targetStringIndexType = getIndexTypeOfType(target, 0 /* String */);
64778
64769
  if (targetStringIndexType) {
64779
64770
  var sourceIndexType = getIndexTypeOfType(source, 0 /* String */) ||
64780
64771
  getImplicitIndexTypeOfType(source, 0 /* String */);
64781
64772
  if (sourceIndexType) {
64782
- inferFromTypes(sourceIndexType, targetStringIndexType);
64773
+ inferWithPriority(sourceIndexType, targetStringIndexType, priority);
64783
64774
  }
64784
64775
  }
64785
64776
  var targetNumberIndexType = getIndexTypeOfType(target, 1 /* Number */);
@@ -64788,7 +64779,7 @@ var ts;
64788
64779
  getIndexTypeOfType(source, 0 /* String */) ||
64789
64780
  getImplicitIndexTypeOfType(source, 1 /* Number */);
64790
64781
  if (sourceIndexType) {
64791
- inferFromTypes(sourceIndexType, targetNumberIndexType);
64782
+ inferWithPriority(sourceIndexType, targetNumberIndexType, priority);
64792
64783
  }
64793
64784
  }
64794
64785
  }
@@ -67014,7 +67005,7 @@ var ts;
67014
67005
  !isGenericIndexType(getTypeOfExpression(parent.argumentExpression));
67015
67006
  }
67016
67007
  function isGenericTypeWithUnionConstraint(type) {
67017
- return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & 1048576 /* Union */);
67008
+ return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
67018
67009
  }
67019
67010
  function containsGenericType(type) {
67020
67011
  return !!(type.flags & 465829888 /* Instantiable */ || type.flags & 3145728 /* UnionOrIntersection */ && ts.some(type.types, containsGenericType));
@@ -78488,21 +78479,24 @@ var ts;
78488
78479
  checkBlock(node.finallyBlock);
78489
78480
  }
78490
78481
  }
78491
- function checkIndexConstraints(type) {
78492
- var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1 /* Number */);
78493
- var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0 /* String */);
78482
+ function checkIndexConstraints(type, isStatic) {
78483
+ var _a, _b, _c, _d;
78484
+ 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 */);
78485
+ 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 */);
78494
78486
  var stringIndexType = getIndexTypeOfType(type, 0 /* String */);
78495
78487
  var numberIndexType = getIndexTypeOfType(type, 1 /* Number */);
78496
78488
  if (stringIndexType || numberIndexType) {
78497
78489
  ts.forEach(getPropertiesOfObjectType(type), function (prop) {
78490
+ if (isStatic && prop.flags & 4194304 /* Prototype */)
78491
+ return;
78498
78492
  var propType = getTypeOfSymbol(prop);
78499
78493
  checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */);
78500
78494
  checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */);
78501
78495
  });
78502
78496
  var classDeclaration = type.symbol.valueDeclaration;
78503
78497
  if (ts.getObjectFlags(type) & 1 /* Class */ && classDeclaration && ts.isClassLike(classDeclaration)) {
78504
- for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) {
78505
- var member = _a[_i];
78498
+ for (var _i = 0, _e = classDeclaration.members; _i < _e.length; _i++) {
78499
+ var member = _e[_i];
78506
78500
  // Only process instance properties with computed names here.
78507
78501
  // Static properties cannot be in conflict with indexers,
78508
78502
  // and properties with literal names were already checked.
@@ -78832,7 +78826,7 @@ var ts;
78832
78826
  }
78833
78827
  if (produceDiagnostics) {
78834
78828
  checkIndexConstraints(type);
78835
- checkIndexConstraints(staticType);
78829
+ checkIndexConstraints(staticType, /*isStatic*/ true);
78836
78830
  checkTypeForDuplicateIndexSignatures(node);
78837
78831
  checkPropertyInitialization(node);
78838
78832
  }
@@ -86101,6 +86095,7 @@ var ts;
86101
86095
  case 120 /* PrivateKeyword */:
86102
86096
  case 121 /* ProtectedKeyword */:
86103
86097
  case 125 /* AbstractKeyword */:
86098
+ case 156 /* OverrideKeyword */:
86104
86099
  case 84 /* ConstKeyword */:
86105
86100
  case 133 /* DeclareKeyword */:
86106
86101
  case 142 /* ReadonlyKeyword */:
@@ -88891,10 +88886,11 @@ var ts;
88891
88886
  return ts.visitEachChild(node, visitor, context);
88892
88887
  }
88893
88888
  var staticProperties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true);
88889
+ var pendingPrivateStateAssignment;
88894
88890
  if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) {
88895
88891
  var temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true);
88896
88892
  getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp);
88897
- getPendingExpressions().push(factory.createAssignment(temp, factory.getInternalName(node)));
88893
+ pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node));
88898
88894
  }
88899
88895
  var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
88900
88896
  var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103 /* NullKeyword */);
@@ -88903,6 +88899,9 @@ var ts;
88903
88899
  /*decorators*/ undefined, node.modifiers, node.name,
88904
88900
  /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass))
88905
88901
  ];
88902
+ if (pendingPrivateStateAssignment) {
88903
+ getPendingExpressions().unshift(pendingPrivateStateAssignment);
88904
+ }
88906
88905
  // Write any pending expressions from elided or moved computed property names
88907
88906
  if (ts.some(pendingExpressions)) {
88908
88907
  statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
@@ -107289,11 +107288,21 @@ var ts;
107289
107288
  // JsxText will be written with its leading whitespace, so don't add more manually.
107290
107289
  return 0;
107291
107290
  }
107292
- else if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
107293
- return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
107294
- }
107295
- else if (!preserveSourceNewlines && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
107296
- return ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1;
107291
+ else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
107292
+ if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
107293
+ return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
107294
+ }
107295
+ // If `preserveSourceNewlines` is `false` we do not intend to preserve the effective lines between the
107296
+ // previous and next node. Instead we naively check whether nodes are on separate lines within the
107297
+ // same node parent. If so, we intend to preserve a single line terminator. This is less precise and
107298
+ // expensive than checking with `preserveSourceNewlines` as above, but the goal is not to preserve the
107299
+ // effective source lines between two sibling nodes.
107300
+ else if (!preserveSourceNewlines && originalNodesHaveSameParent(previousNode, nextNode)) {
107301
+ return ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1;
107302
+ }
107303
+ // If the two nodes are not comparable, add a line terminator based on the format that can indicate
107304
+ // whether new lines are preferred or not.
107305
+ return format & 65536 /* PreferNewLine */ ? 1 : 0;
107297
107306
  }
107298
107307
  else if (synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format)) {
107299
107308
  return 1;
@@ -107933,10 +107942,13 @@ var ts;
107933
107942
  }
107934
107943
  exitComment();
107935
107944
  }
107945
+ function originalNodesHaveSameParent(nodeA, nodeB) {
107946
+ nodeA = ts.getOriginalNode(nodeA);
107947
+ // For performance, do not call `getOriginalNode` for `nodeB` if `nodeA` doesn't even
107948
+ // have a parent node.
107949
+ return nodeA.parent && nodeA.parent === ts.getOriginalNode(nodeB).parent;
107950
+ }
107936
107951
  function siblingNodePositionsAreComparable(previousNode, nextNode) {
107937
- if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) {
107938
- return false;
107939
- }
107940
107952
  if (nextNode.pos < previousNode.end) {
107941
107953
  return false;
107942
107954
  }
@@ -113309,8 +113321,14 @@ var ts;
113309
113321
  var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
113310
113322
  for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
113311
113323
  var name = _a[_i];
113312
- var optionInfo = optionsNameMap.get(name.toLowerCase());
113313
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) || name === "skipLibCheck" || name === "skipDefaultLibCheck") {
113324
+ var optionKey = name.toLowerCase();
113325
+ var optionInfo = optionsNameMap.get(optionKey);
113326
+ if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
113327
+ // We need to store `strict`, even though it won't be examined directly, so that the
113328
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
113329
+ optionKey === "strict" ||
113330
+ // We need to store these to determine whether `lib` files need to be rechecked.
113331
+ optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
113314
113332
  (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
113315
113333
  }
113316
113334
  }
@@ -116819,7 +116837,7 @@ var ts;
116819
116837
  },
116820
116838
  emit: function (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
116821
116839
  if (targetSourceFile || emitOnlyDtsFiles) {
116822
- return withProgramOrUndefined(function (program) { return program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); });
116840
+ 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))); });
116823
116841
  }
116824
116842
  executeSteps(BuildStep.SemanticDiagnostics, cancellationToken);
116825
116843
  if (step === BuildStep.EmitBuildInfo) {
@@ -116904,6 +116922,7 @@ var ts;
116904
116922
  }
116905
116923
  function emit(writeFileCallback, cancellationToken, customTransformers) {
116906
116924
  var _a;
116925
+ var _b, _c;
116907
116926
  ts.Debug.assertIsDefined(program);
116908
116927
  ts.Debug.assert(step === BuildStep.Emit);
116909
116928
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
@@ -116914,7 +116933,7 @@ var ts;
116914
116933
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
116915
116934
  /*write*/ undefined,
116916
116935
  /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
116917
- /*emitOnlyDts*/ false, customTransformers).emitResult;
116936
+ /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
116918
116937
  // Don't emit .d.ts if there are decl file errors
116919
116938
  if (declDiagnostics) {
116920
116939
  program.restoreState();
@@ -116996,6 +117015,7 @@ var ts;
116996
117015
  return emitDiagnostics;
116997
117016
  }
116998
117017
  function emitBundle(writeFileCallback, customTransformers) {
117018
+ var _a, _b;
116999
117019
  ts.Debug.assert(kind === InvalidatedProjectKind.UpdateBundle);
117000
117020
  if (state.options.dry) {
117001
117021
  reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
@@ -117011,7 +117031,7 @@ var ts;
117011
117031
  var outputFiles = ts.emitUsingBuildInfo(config, compilerHost, function (ref) {
117012
117032
  var refName = resolveProjectName(state, ref.path);
117013
117033
  return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
117014
- }, customTransformers);
117034
+ }, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project)));
117015
117035
  if (ts.isString(outputFiles)) {
117016
117036
  reportStatus(state, ts.Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
117017
117037
  step = BuildStep.BuildInvalidatedProjectOfBundle;
@@ -121279,9 +121299,7 @@ var ts;
121279
121299
  [8 /* OptionalDependencies */, info.optionalDependencies],
121280
121300
  [4 /* PeerDependencies */, info.peerDependencies],
121281
121301
  ];
121282
- return __assign(__assign({}, info), { parseable: !!content, fileName: fileName,
121283
- get: get,
121284
- has: function (dependencyName, inGroups) {
121302
+ return __assign(__assign({}, info), { parseable: !!content, fileName: fileName, get: get, has: function (dependencyName, inGroups) {
121285
121303
  return !!get(dependencyName, inGroups);
121286
121304
  } });
121287
121305
  function get(dependencyName, inGroups) {
@@ -123737,6 +123755,8 @@ var ts;
123737
123755
  return jsdocCompletionInfo(ts.JsDoc.getJSDocTagCompletions());
123738
123756
  case 3 /* JsDocParameterName */:
123739
123757
  return jsdocCompletionInfo(ts.JsDoc.getJSDocParameterNameCompletions(completionData.tag));
123758
+ case 4 /* Keywords */:
123759
+ return specificKeywordCompletionInfo(completionData.keywords);
123740
123760
  default:
123741
123761
  return ts.Debug.assertNever(completionData);
123742
123762
  }
@@ -123745,6 +123765,19 @@ var ts;
123745
123765
  function jsdocCompletionInfo(entries) {
123746
123766
  return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries };
123747
123767
  }
123768
+ function specificKeywordCompletionInfo(keywords) {
123769
+ return {
123770
+ isGlobalCompletion: false,
123771
+ isMemberCompletion: false,
123772
+ isNewIdentifierLocation: false,
123773
+ entries: keywords.map(function (k) { return ({
123774
+ name: ts.tokenToString(k),
123775
+ kind: "keyword" /* keyword */,
123776
+ kindModifiers: "" /* none */,
123777
+ sortText: SortText.GlobalsOrKeywords,
123778
+ }); }),
123779
+ };
123780
+ }
123748
123781
  function getOptionalReplacementSpan(location) {
123749
123782
  // StringLiteralLike locations are handled separately in stringCompletions.ts
123750
123783
  return (location === null || location === void 0 ? void 0 : location.kind) === 78 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
@@ -124169,6 +124202,8 @@ var ts;
124169
124202
  return ts.JsDoc.getJSDocTagCompletionDetails(name);
124170
124203
  case 3 /* JsDocParameterName */:
124171
124204
  return ts.JsDoc.getJSDocParameterNameCompletionDetails(name);
124205
+ case 4 /* Keywords */:
124206
+ return request.keywords.indexOf(ts.stringToToken(name)) > -1 ? createSimpleDetails(name, "keyword" /* keyword */, ts.SymbolDisplayPartKind.keyword) : undefined;
124172
124207
  default:
124173
124208
  return ts.Debug.assertNever(request);
124174
124209
  }
@@ -124227,6 +124262,7 @@ var ts;
124227
124262
  CompletionDataKind[CompletionDataKind["JsDocTagName"] = 1] = "JsDocTagName";
124228
124263
  CompletionDataKind[CompletionDataKind["JsDocTag"] = 2] = "JsDocTag";
124229
124264
  CompletionDataKind[CompletionDataKind["JsDocParameterName"] = 3] = "JsDocParameterName";
124265
+ CompletionDataKind[CompletionDataKind["Keywords"] = 4] = "Keywords";
124230
124266
  })(CompletionDataKind || (CompletionDataKind = {}));
124231
124267
  var CompletionKind;
124232
124268
  (function (CompletionKind) {
@@ -124387,13 +124423,17 @@ var ts;
124387
124423
  var importCompletionNode;
124388
124424
  var location = ts.getTouchingPropertyName(sourceFile, position);
124389
124425
  if (contextToken) {
124426
+ var importCompletionCandidate = getImportCompletionNode(contextToken);
124427
+ if (importCompletionCandidate === 153 /* FromKeyword */) {
124428
+ return { kind: 4 /* Keywords */, keywords: [153 /* FromKeyword */] };
124429
+ }
124390
124430
  // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
124391
124431
  // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
124392
124432
  // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
124393
124433
  // to opt in with the `includeCompletionsForImportStatements` user preference.
124394
- importCompletionNode = preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText
124395
- ? getImportCompletionNode(contextToken)
124396
- : undefined;
124434
+ if (importCompletionCandidate && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
124435
+ importCompletionNode = importCompletionCandidate;
124436
+ }
124397
124437
  // Bail out if this is a known invalid completion location
124398
124438
  if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
124399
124439
  log("Returning an empty list because completion was requested in an invalid position.");
@@ -126147,16 +126187,20 @@ var ts;
126147
126187
  }
126148
126188
  function getImportCompletionNode(contextToken) {
126149
126189
  var candidate = getCandidate();
126150
- return candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined;
126190
+ return candidate === 153 /* FromKeyword */ || candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined;
126151
126191
  function getCandidate() {
126152
126192
  var parent = contextToken.parent;
126153
126193
  if (ts.isImportEqualsDeclaration(parent)) {
126154
126194
  return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined;
126155
126195
  }
126156
126196
  if (ts.isNamedImports(parent) || ts.isNamespaceImport(parent)) {
126157
- return isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name
126158
- ? parent.parent.parent
126159
- : undefined;
126197
+ if (isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name) {
126198
+ // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from`
126199
+ return contextToken.kind === 19 /* CloseBraceToken */ || contextToken.kind === 78 /* Identifier */
126200
+ ? 153 /* FromKeyword */
126201
+ : parent.parent.parent;
126202
+ }
126203
+ return undefined;
126160
126204
  }
126161
126205
  if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) {
126162
126206
  // A lone import keyword with nothing following it does not parse as a statement at all
@@ -127681,9 +127725,7 @@ var ts;
127681
127725
  var name_1 = displayParts_1.map(function (p) { return p.text; }).join("");
127682
127726
  var declaration = symbol.declarations && ts.firstOrUndefined(symbol.declarations);
127683
127727
  var node = declaration ? (ts.getNameOfDeclaration(declaration) || declaration) : originalNode;
127684
- return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: name_1,
127685
- kind: kind_1,
127686
- displayParts: displayParts_1, context: getContextNode(declaration) });
127728
+ return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: name_1, kind: kind_1, displayParts: displayParts_1, context: getContextNode(declaration) });
127687
127729
  }
127688
127730
  case 1 /* Label */: {
127689
127731
  var node = def.node;
@@ -127718,10 +127760,7 @@ var ts;
127718
127760
  }
127719
127761
  })();
127720
127762
  var sourceFile = info.sourceFile, textSpan = info.textSpan, name = info.name, kind = info.kind, displayParts = info.displayParts, context = info.context;
127721
- return __assign({ containerKind: "" /* unknown */, containerName: "", fileName: sourceFile.fileName, kind: kind,
127722
- name: name,
127723
- textSpan: textSpan,
127724
- displayParts: displayParts }, toContextSpan(textSpan, sourceFile, context));
127763
+ return __assign({ containerKind: "" /* unknown */, containerName: "", fileName: sourceFile.fileName, kind: kind, name: name, textSpan: textSpan, displayParts: displayParts }, toContextSpan(textSpan, sourceFile, context));
127725
127764
  }
127726
127765
  function getFileAndTextSpanFromNode(node) {
127727
127766
  var sourceFile = node.getSourceFile();
@@ -148140,8 +148179,10 @@ var ts;
148140
148179
  }
148141
148180
  if (context.preferences.provideRefactorNotApplicableReason) {
148142
148181
  return [
148143
- { name: refactorName, description: namespaceToNamedAction.description, actions: [__assign(__assign({}, namespaceToNamedAction), { notApplicableReason: info.error })] },
148144
- { name: refactorName, description: namedToNamespaceAction.description, actions: [__assign(__assign({}, namedToNamespaceAction), { notApplicableReason: info.error })] }
148182
+ { name: refactorName, description: namespaceToNamedAction.description,
148183
+ actions: [__assign(__assign({}, namespaceToNamedAction), { notApplicableReason: info.error })] },
148184
+ { name: refactorName, description: namedToNamespaceAction.description,
148185
+ actions: [__assign(__assign({}, namedToNamespaceAction), { notApplicableReason: info.error })] }
148145
148186
  ];
148146
148187
  }
148147
148188
  return ts.emptyArray;
@@ -165500,9 +165541,7 @@ var ts;
165500
165541
  var span = toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo);
165501
165542
  var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1);
165502
165543
  var lineText = scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, "");
165503
- return __assign(__assign({ file: fileName }, span), { lineText: lineText,
165504
- isWriteAccess: isWriteAccess,
165505
- isDefinition: isDefinition });
165544
+ return __assign(__assign({ file: fileName }, span), { lineText: lineText, isWriteAccess: isWriteAccess, isDefinition: isDefinition });
165506
165545
  }
165507
165546
  function isCompletionEntryData(data) {
165508
165547
  return data === undefined || data && typeof data === "object"